Software Archive
Read-only legacy content
17061 Discussions

PushNotifications using PhoneGap and GCM for iOS

Matheus_O_
Beginner
233 Views
        var push = PushNotification.init({ 
            "android": {
                "senderID": "mySenderID"
            },
            "ios": {
                "senderID": "mySenderID", 
                "alert": "true", 
                "badge": "true", 
                "sound": "true",
                "gcmSandbox": "true"
            }, 
            "windows": {} 
        });

        push.on('registration', function(data) {
            dispToken = data.registrationId;
        });

        push.on('notification', function(data) {
            console.log(data.message);
            alert(data.title+" Message: " +data.message);
            // data.title,
            // data.count,
            // data.sound,
            // data.image,
            // data.additionalData
        });

        push.on('error', function(e) {
            console.log(e.message);
        });

 

dispToken is the internal variable that I use to save the Token into my database. I have already enabled GCM for iOS on Google. When I push the notification using my PHP page it returns me a JSON with success message. On android it runs flawlessly, but on iOS I never got the push. Any ideas?

PS.: My iOS certificate is a production one. Also, changing gcmSandbox to true or false doesn't make any difference

0 Kudos
2 Replies
Elroy_A_Intel
Employee
233 Views

I recommend that you review the steps for configuring push notification into your certificate as this might be what you are missing. 

https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html#//apple_ref/doc/uid/TP40012582-CH26-SW11

0 Kudos
ANTÔNIO_C_
Beginner
233 Views

Matheus,

 

I've been experiencing the same problem. Did you have yours solved ? My problem seems to be the certificate. Your problem was the certificate too ?

 

Thanks in advance,

Antônio Costa

 

0 Kudos
Reply