Search code examples
androidcordovapush-notificationphonegap-plugin-push

cordova phonegap-plugin-push v1.x - how to make it work with Android 8.1 (API level 27)


We use the phonegap-plugin-push in one of our apps and it works really well - up to Android 7 (haven't tested Android 8).

However, Android 8.1 phone don't show notifications

we use

 cordova CLI 8.1.2
 cordova-android 6.4.0
 phonegap-plugin-push 1.10.7

As android platform 6.x does not support API level 27, we updated to android platform 7.1.1 - no effect

Then, we updated to phonegap-plugin-push 1.11.1 - also no effect.

I'd really be glad to hear which versions you are using and if / how you manage get push notifications also on Android 8.1 ... or any other ideas how to make this work?

Do I need to upgrade to the push plugin v2.x branch?

Thanks for any help in advance!


Solution

  • Well, when reading the documentation you understand that the support for channels which is required for Android >= 8 is only supported by the 2.x versions of the phonegap-plugin-push.

    In fact, updating wasn't that complicated. You need to:

    • register with FCM and get the google-services.json (and put it in the config.xml, see docs)
    • remove all GCM IDs you might sill have in your code and config.xml
    • and you should add the channels as you would get the default text otherwise in the Android config

    Also notice that by now (2.2.3) you have to check for the android platform before calling listChannels() as this there is no dummy implementation for the other platforms (yet).