liccowee / Google-Cloud-Messaging--Titanium-

Google Cloud Messaging in Titanium
Other
78 stars 49 forks source link

Push when app is closed #43

Open patriciapg93 opened 9 years ago

patriciapg93 commented 9 years ago

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:

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
            });

        }
    });
};

Thank you!

bayethiernodiop commented 9 years ago

i have the probleme help please

chmiiller commented 8 years ago

Hi, is there a way to use this module for Urban Airship? Thank you!