I am trying to make GCM push notifications work in my app and therefore I am using this project (https://github.com/marknutter/GCM-Cordova) as an example.
When I run the example code everything works fine, but when I transfer all the required files and edit my code to let it work in my own app it does not work anymore. I also tried the following plugin (https://github.com/phonegap-build/PushPlugin) and after installing it automatically it gives exactly the same error.
The app does not crash, but when I call the register function my callback function "onNotificationGCM" does not receive any messages back.
window.plugins.GCM.register("my_gcm_id", "onNotificationGCM", successHandler, errorHandler );
Native android code:
LogCat gives the following 'failed' message:
The capital J in front of the message is strange and maybe that is what causes the problem, but it seems to be happening somewhere in the Cordova 2.5.0 code.
Does anyone have any idea how I can solve this?
Try to add
window.onNotificationGCM = onNotificationGCM;
to change the context of your function
It solve the problem for me