I have followed this tutorial and I have the following code:
onDeviceReady I execute:
var pushNotification = window.plugins.pushNotification;
pushNotific
register
When you call pushNotification.register()
:
successHandler
is called if there is no error in parsing your ecb
and senderID
. Your senderID
and application are registered with GCMRegistrar.errorHandler
is called only if there is a JSON error while parsing the ecb
or senderID
Once your setup is correct, your errorHandler
will probably never be called.
From the docs, you have to call the register
method every time you start the application. This will not create duplicate registrations. The plugin will manage all that itself.
onNotificationGCM
Only called when:
GCMRegistrar
GCMRegistrar
senderID
) if already registered.senderID
and then returns registration ID. This requires an Internet connection (AFAIK)So when you call pushNotification.register
the first time, if you are not connected to the Internet, PushPlugin returns OK
but GCMRegistrar has no registration ID to return to you.