phonegap-build / PushPlugin

This repository is deprecated head to phonegap/phonegap-push-plugin
https://github.com/phonegap/phonegap-plugin-push
MIT License
1.31k stars 996 forks source link

The application is launched when click status bar notification, but does not detect coldstart state #179

Open robagi opened 10 years ago

robagi commented 10 years ago

Everything works perfectly, notifications are received and launched in the status bar and they open my application when touched.

The code is on the main page of my application that opens when you tap the notification and successfully show labels "INLINE NOTIFICATION" and "BACKGROUND NOTIFICATION" whichever is applicable

The problem comes when my application is off (meaning coldstate) , the application is launched successfully but does not run the action inside the "if ( e.coldstart )"

boltex commented 10 years ago

I have the sam problem. Did you fixed it?

I notice in my debug console i get : D/CordovaLog(5754): file:///android_asset/www/cordova.js: Line 1036 : processMessage failed: Stack: ReferenceError: onNotificationGCM is not defined.

It tries to process the notification before my application finishes initializing the notification plugin!

sandeepshetty commented 10 years ago

Dup of #35

gdelavald commented 10 years ago

@boltex Make sure you initialize PushPlugin variable at onDeviceReady event.

 function onDeviceReady() {
    // Now safe to use the PhoneGap API
    pushNotification = window.plugins.pushNotification;
boltex commented 10 years ago

Thank you, indeed initializing pushNotification sooner (before angularJS) when onDeviceReady fired made it work!

Many thanks again!