Announcing PhoneGap Push Plugin version 2.0.0

Simon MacDonald
PhoneGap
Published in
2 min readAug 14, 2017

We’re happy to announce the release of the updated PhoneGap Push plugin that brings support for Firebase Cloud Messaging (FCM) to Apache Cordova apps on iOS and Android! Don’t worry APNS fans, you can still use that push notification method on iOS.

Version 2.0.0 of the Push Notification plugin follows the same API as version 1.x.y except for the way you configure connection with FCM, which is now done via a configuration file downloaded from Google.

Now that we have FCM support we can start thinking about version 3.0.0 which will align with the W3C Push API.

Push Notification Plugin Installation Instructions

If you currently have a project using GCM follow Google’s instructions on migrating to FCM. Once you have a FCM project you’ll be able to download the configuration files needed to properly setup the push plugin.

Add the google-services.json file to your project:

<platform name="android">
<resource-file src="google-services.json" target="google-services.json" />
</platform>

If you want to use FCM instead of APNS on iOS then add the GoogleService-Info.plist to your project. If you don’t supply this file iOS will default to APNS.

<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
</platform>

Add the plugin to your project:

$ phonegap plugin add phonegap-plugin-push

(or)

$ cordova plugin add phonegap-plugin-push

Folks familiar with the version 1.x of the plugin will remember they need to provide the SENDER_ID to connect to GCM. That’s no longer needed with FCM, so your init method looks more like this:

var push = PushNotification.init({
android: {},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
ios: {
alert: "true",
badge: true,
sound: 'false'
},
windows: {}
});

Everything else should work exactly the same as the 1.x version of the plugin and you should be back to receiving push notifications in no time.

Android

iOS

PhoneGap Build Support

Version 2.0.0 of the plugin is fully supported on PhoneGap Build. Please read this recent blog post by Ryan in order to properly configure your project.

Contact Us

Your feedback is graciously accepted and appreciated!
Please submit your pull requests and issues here.

--

--

Simon MacDonald
PhoneGap

Father, Software Engineer, Comic Enthusiast, Coffee Lover and Developer 🥑 for @AdobeIO