Setting push_dev to false makes Android push.register fail


#1

Using the phonegap_plugin_push i got everything up and running with iOS.

Starting on Android, things seem to work perfectly well as long as push_dev is set to true. Once i change it to false, i get the following error in the console:

[INFO:CONSOLE(20434)] "TypeError: Cannot read property 'on' of undefined at e.i.value (file:///android_asset/www/lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js:3:11100) at e.i.value (file:///android_asset/www/lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js:3:6575) at file:///android_asset/www/js/controllers.js:41:26 at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:18196:11 at processQueue (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22016:27) at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22032:27 at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:23228:28) at Scope.$digest (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:23044:31) at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:23333:24) at done (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:18486:47)", source: file:///android_asset/www/lib/ionic/js/ionic.bundle.js (20434)

It seems to me that this part of the code is what’s causing the error:

push.register(function(token) {
    console.log("Device token:" + token.token);
    push.saveToken(token);  // persist the token in the Ionic Platform
});

I’ve noticed that many others also seem to have the same problem, but none of the solutions suggested seem to work on my project. Anyone who have any ide how to get this to work on Android?


#2

Any chance you ever got a solution for this? I am running into that exact same issue right now. Thanks for the help!