I am using Titanium's push notification functionality with alloy for Android and iOS. I am initializing push notification subscription from alloy.js, i.e. basically calling CloudPush's retrieveDeviceToken method to get a device token and then
Cloud.PushNotifications.subscribe({
channel : _channel,
device_token : _token,
type : OS_IOS ? 'ios' : 'android'
}, function(_event) {..}
The challenge is that, alloy.js gets called everytime I will restart the app. That means a new device token is generated and channel is subscribed again and again on every restart of app.
I am wondering if this is the right way to use the push subscription. Is there a way to avoid these multiple subscriptions from the same device.