I am using this module in my app and it works fine when it is in foreground and background. I receive the notification when the app is closed too.
I need to show a specific view when the user clicks on the notification, but when the app is closed it does not even enter in the callback (where I have a fireEvent to show the view), it simply opens the app.
Is there a way to achieve this?
Here is my pushNotification code:
exports.pushNotification = function() {
var gcm = require('com.activate.gcm');
gcm.registerC2dm({
success : function(e) {// REGISTER FOR PUSH CORRECTE
var myID = gcm.getRegistrationId();
myID = myID.toString();
Titanium.App.Properties.setString("deviceToken", myID);
Titanium.App.Properties.setString("pushRegistered2", "1");
},
error : function(e) {// ERROR AL REGISTRE
Ti.API.info("Error during registration : " + JSON.stringify(e));
},
callback : function(e)// called when a push notification is received
{
Ti.API.info('JS message event: ' + JSON.stringify(e.data));
Alloy.Globals.lastPushMessage = e.data.message;
// Here I "launch" the specific view
Ti.App.fireEvent('view:FavoriteView', {
push : e.data
});
}
});
};
Hi,
I am using this module in my app and it works fine when it is in foreground and background. I receive the notification when the app is closed too.
I need to show a specific view when the user clicks on the notification, but when the app is closed it does not even enter in the callback (where I have a fireEvent to show the view), it simply opens the app.
Is there a way to achieve this?
Here is my pushNotification code:
Thank you!