I am required to send statistics if the app was opened or resumed from push notification.
How do I detect it in Titanium?
in particular, on iOS (on Android, I believe that the cgm module I am using has an event)
I am required to send statistics if the app was opened or resumed from push notification.
How do I detect it in Titanium?
in particular, on iOS (on Android, I believe that the cgm module I am using has an event)
On iOS, for received notifications (within iOS App and not from lock screen, though they will be triggered when tapped/swiped on from lock screen), you can use the following:
For iOS Remote Notifications: When registering for Push Notifications, use the call back function to listen for all incoming remote notifications.
Ti.Network.registerForPushNotifications({
success: deviceTokenSuccess, // TODO store the token
error: deviceTokenError, // TODO
callback: receivePush // function below
});
function receivePush(e) {
alert('Received push: ' + JSON.stringify(e));
// Do what you need for Analytics here
}
For iOS Local Notification with Actions (iOS 8+)
Ti.App.iOS.addEventListener("localnotificationaction",function(){
//my code
});
For iOS Local Notifications:
Ti.App.iOS.addEventListener('notification',function(){
// send analytics
});