Archived Blog

All the old blog posts, written from 2008 to 2017

PhoneGap Push Plugin 1.9.0

We haven’t done a post regarding phonegap-plugin-push for awhile, but we have just released version 1.9.0! Along with bug fixes and general improvements there are three main things you should know about:

  1. Default SENDER_ID
  2. CocoaPod Support
  3. Force Start for Android


In order to add the push plugin to your app you need to specify a SENDER_ID:

$ phonegap plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"

But in order to make life easier for developers you can now do:

$ phonegap plugin add phonegap-plugin-push

and it will use the default SENDER_ID to be used with the phonegap push command. It’s equivalent to doing:

$ phonegap plugin add phonegap-plugin-push --variable SENDER_ID="85075801930"

You’ll still be able to override this value as part of the options passed to the init method for Android. For using GCM over iOS you’ll need to remove and add the plugin again with your correct SENDER_ID.

CocoaPod Support

Speaking of GCM over iOS, we’ve removed the GCM libraries from the plugin repo and they are now fetched and installed via CocoaPod. This has the benefit of making the plugin repo much smaller and help avoid dependency issues where more than one plugin include the same library.

Check out cordova-ios 4.3.0 announcement for more details.

Force Start for Android

When an Android app is forced closed by the user you can still get push notification in the notification shade but your notification handler is not called as the web view is not running. Now you can set the force-start property in your push payload which will start your app in the background on Android. This will require cordova-android@6.0.0 or greater.

Sample push payload:

    "registration_ids": ["my device id"],
    "data": {
        "title": "Force Start",
        "message": "This notification should restart the app",
        "force-start": 1

What’s New

For those interested in the full CHANGELOG:

v1.9.0 (2016-07-09)

Full Changelog