You need to enable Push Notifications in the app and in the backend services (server).
To turn on messages for the app in the backend services:
- Click on the Push link in the App Builder Toolbar:
The settings page for this app will open in a new tab.
Note that you can also switch to the Push Notifications tab directly from the Project Information page:
- Check the Enable Push Notifications checkbox to enable Push Notifications for this app:
You will be notified that the next step is linking the app with the database of your choice.
Push Notifications require using a database. The database stores all registered devices and allows sending targeted Push Notification messages.
For Database, click the Select database button. We recommend creating a new database but you can also use an existing one. Device information is stored in the built-in Devices collection:
Make sure that under the Settings section, all the three options are checked:
Android Badges Support
Some Android launchers also support badges.
You can read here to learn more.
Push Notification Provider
Please be aware that GCM provider is not supported by Google anymore. Therefore, only FCM provider settings are available.
Learn how to migrate your project from GCM to FCM here.
Existing Firebase Project
This section shows how to create a new project. You can also use an existing project.
- Go to http://firebase.google.com and log in with your developer credentials. If you are already signed in, you will see the Go to console link in the upper right corner.
- Click the Create a project button.
- Enter the project name, for example, ApperyioPush. Select your country/region and click Create Project.
- In the upper left corner, click on the gear icon next to the "Project Overview" and select the "Project settings" option:
- Click on the Android icon in the Your apps section:
- Enter the app package name, for example: io.appery.mypnapp.
This name should match the name inside the App Builder in Project > App settings > Android binary:
- Click Register App:
- Click Download google-services.json and save the google-services.json file to your drive.
- Click Next, skip the Add Firebase SDK section, click Next and then Continue to console.
- Select the Service accounts tab.
- Click Generate new private key: and then Generate key:
- Download your Firebase private key file to your drive.
- Return to Push Notification Settings in Appery.io.
- Click the Change button to upload google-services.json in Google Services JSON File input:
- Similarly, click the Change button to upload Firebase private key in Firebase Admin SDK JSON File.
The next steps were required before, but now Google enables Firebase Cloud Messaging API automatically. You can check the steps to be sure that Firebase Cloud Messaging API is enabled.
Your Push Notifications setting are saved successfully:
- Go to https://console.cloud.google.com/apis/dashboard and log in with your developer credentials.
- Select your Firebase project in the upper left corner. If you have only one project, it will be selected automatically.
- Click Enable APIs and services.
- Enter Firebase Cloud Messaging API in search input.
- Click Firebase Cloud Messaging API.
- Click Enable.
To create a Google Play account you'll need to pay a one-off $25 registration fee. You may be asked to verify your identity using a valid ID to complete your account registration. If we can't verify your identity, the registration fee won't be refunded.
To enable Push Notifications for an iOS app, you must have a Development Certificate if your app is registered in the Development mode, and a Production Certificate if your app is registered in the Distribution mode.
- If you are using a Production Certificate, check the Production option in the iOS settings section. If you are using a Development Certificate, leave it unchecked:
- Also, you will need to upload the Push Notification
Client SSLcertificate you downloaded from the Apple Developer portal.
- To generate a Push Notifications certificate, you need to open the App Ids page, find the desired App ID, click Configure, and check the Enable for Apple Push Notification service checkbox. Then click Configure (selecting either Development or Production stage).
For configuring sending pushes, you will need a different certificate from the one you get for signing your app but the flow of converting it is the same - using
opensslwith exactly the same commands.
You can check this video to learn how it's done.
- Fill in the Certificate password that was specified during .p12 certificate creation:
That’s it for iOS configuration.
iOS Bundle ID
The Bundle ID shouldn’t have a wild card character, otherwise, you will not be able to configure push notification properties.
Cordova Plugin requirements
The google-services.json file is required with PushPlugin Cordova plug-in for successful project builds. Please don't enable this plug-in before configuring Android settings.
To enable Push Notifications in an app, the Push Notifications plug-in has to be activated. Go to Project > App settings > Cordova plugins and enable the PushPlugin Cordova plug-in (and the Device Cordova plug-in for JQM projects):
For Ionic 5 projects, enabling the Device Cordova Plug-in is not required.
Before version 2.0, Cordova PushPlugin used Google Cloud Messaging provider to register devices. As GCM is not supported by Google, all projects with the Cordova PushPlugin version lower than 2.0 do not receive push notifications anymore.
- Setup Firebase Cloud Messaging provider on the Push tab.
- Update PushPlugin Cordova plug-in in your project. It should be at least of 2.0 version.
- Publish your project.
Users won't be able to receive push notifications until they update application. The auto update feature won't help in this case.
Updated 4 months ago