Updated April 17, 2023
Introduction to Phonegap Push plugin
Phonegap push plugin supports receiving and handling native push notifications with a single API. It does not mean that users have the ability to send a single push message and arrive on devices that run different Operating Systems. Android uses FCM, Firebase Cloud Messaging, and iOS use APNS by default, with different payloads. Even if the user tries to use FCM for both iOS and Android, a difference is seen in the payload required by the plugin to work as required. Here, we shall see what the Phonegap push plugin is, and what are all the updates have happened along with a brief on push plugins or notifications.
Phonegap was developed by Nitobi, a company based in Vancouver in Canada, and was acquired by Adobe Corporation in the year of 2011. After the acquisition of Nitobi by Adobe Corporation in the year 201, Adobe had released a Phonegap technology as an open-source under Apache Cordova.
How Phonegap push plugin works?
- Phonegap push plugin is a Cordova plugin used for registering and receiving push notifications.
- Plugin does not provide a way in determining the platform, and the best platform to use the property device. the platform provided by Cordova-plugin-device.
- Architecture, along with open source not only allows developers to fix bugs in code but allows users to tweak plugins as per requirements.
- Developer can build own plugins, and support platform of user’s choice.
- To send push notifications to Cordova applications, the first step is obtaining a device token, which is specific to each device and project.
- Prerequisites: To have a Google Cloud Messaging project number and API key for Type Server.
- And then adding the Cordova Push plugin to our project, sender id in Cordova plugin.
- On running the code on Android or iOS device gives device token, this token generates a real device and not a virtual device.
- For iOS users, an APN authentication key or APN certificate is a requisite, to create an APN certificate on iOS debug build, users should have Apple Developer Program and to create Developer APN certificate, app ID with a push notification enabling is needed while creation of APN certificate
- App ID and explicit ID are needed for the push notification, need to be unique.
- Under App Services, the Push Notification option is to be selected, needs to be confirmed and registered.
- Once the App ID is created, move to the iOS app and select the registered app ID from the dropdown, and edit.
- On editing, click on the “Create Certificate” button, choose the CSR file. This file can be taken from Monaca Cloud IDE. This will help in generating CSR and key
- Download both the files and upload them in iOS build settings as these are needed for Firebase configuration
- Under Firebase push notification, create a project, and under project settings, go to ADD APP and select the operating system, as in iOS(here).
- Enter iOS bundle ID and register. Download the displayed .plist file which should be placed in the root folder of the registered project.
- On the Firebase Overview page, go to project settings, and select Cloud Messaging to add the APN certificate. Here, uploads the APN authentication key or the APN certificate.
- Hence, the iOS configuration is done for the Phonegap push plugin to work.
- Phonegap supports other platforms such as Blackberry, Web OS, Windows Phone, Tizen, Bada, and Symbian.
Advantages of Phonegap push plugin,
1. Based on the open standards, users can reuse the existing web developer skills.
2. Single codebase can be mentioned for multiple platforms and has a faster development.
3. It has a Robust background, backed by Apache and powered by Apache Cordova.
limitations or the disadvantages of Phonegap push plugin,
1. Access to number of native functionality APIs is not much supported by PhoneGap’s API.
2. Applications that use advanced graphics may be accessed by third-party libraries, can be done natively
4. As the business logic complexity increases, applications can be accessed better with native code.
With this, we shall conclude the topic “Phonegap push plugin”. We have seen what the Phonegap push plugin means and how is it implemented in iOS and Android operating systems. We have also seen the Cordova plugin as the Phonegap push plugin has been now deprecated. Have listed out a few of the advantages and limitations of Phonegap push plugin.
This is a guide to Phonegap Push Plugin. Here we discuss the Introduction, How Phonegap push plugin works? advantages, limitations, respectively. You may also have a look at the following articles to learn more –