Firebase Cloud Messaging : Stay up-to-date for sending push notifications on Android
Written by Jerome Granados on
In April 10, 2018 Google warned developers of a technical change in sending and receiving push notifications.
GoodBarber took this change into account by updating the Android engine of your apps.
Firebase Cloud Messaging, the system used to send and receive push notifications will therefore be the only system in effect from April 11, 2019.
This article shows you whether or not you need to rebuild and submit an update of your app in the Play Store to keep push notifications working in your Android app.
GoodBarber takes care of everything and it’s better this way :)
You probably missed the announcement by Google and it’s perfectly normal.
It’s GoodBarber's job to make sure that your Android app adapts to Google's regular updates (and Apple's iOS app)
When you know the fast pace of these developments, it's very reassuring to know that all GoodBarber subscriptions include this maintenance.
And, when you think about it, it represents a significant financial saving for the owner of the app. Imagine if you had to ask a developer to intervene whenever there is a change on Google or Apple!
Another, often underestimated, advantage of using an App Builder ;)
Migration from GCM to FCM: what does it mean?
Last April, Google decided to replace Google Cloud Messaging (GCM) by Firebase Cloud Messaging (FCM).
Both systems are used to manage the sending and receiving of push notifications.
GCM is the first system designed by Google. GoodBarber started using GCM in 2011, with GoodBarber V1!
Since then, Google has largely evolved its infrastructure and asks developers to use FCM.
From April 11, 2019 the use of FCM will be mandatory for all developers.
What are push notification and how do they work?
A push notification is a message addressed to mobile apps users. This message is received directly on the user’s mobile phone. The reception, display and action associated with the message are managed by the phone’s operating system.
Here’s a simple explanation on how it works:
Step 1: The publisher of an app (you) writes a message (push notification) to send it to its users (phones).
Once written, the publisher forwards the message to a Push Service Delivery.
There are several Push Service Delivery. For example, GoodBarber uses:
- Firebase Cloud Messaging (FCM): for native Android app and for PWA s viewed with Chrome, Firefox, Opera or Edge.
- Apple Push Notification System (APNs): for native iOS applications and for PWAs viewed from Safari macOS.
When transmitting its message to Push Service Delivery, the publisher can specify criteria to target specific phones.
Specifically, these are all the targeting options you can access from the User> Push> Send page of your backoffice.
Step 2: The Push Delivery Service identifies the phones for which it must transmit the message and sends them.
These are the phones for which the user has agreed to receive push notifications from your app and who are in the target you set when writing your message.
How does the message delivery service know which phones to send a notification to?
When a user downloads your app for the first time on their phone, a push token is created and assigned to the phone.
It is this token which then makes it possible to identify the phone on which the push notification must be sent.
The Push Service Delivery is responsible for assigning the token to the phone.
In the case of GoodBarber's Android apps, before, it was GCM that attributed the push tokens, now it's FCM
Migration from GCM to FCM: Should I rebuild and update my Android app?
From April 11, 2019, Google will turn off GCM. To find out if closing GCM has any implication on your app, first check which version of the Android engine was used to generate the latest version of your app.
We are talking about the latest version of your app that is available for download in Google Play.
To find out, go to the menu Publish> Update > Versions
Next to the version number, in brackets, you have the revision number of the Android engine used to build your app.
If the revision number is greater than or equal to 6035, then you have nothing to do. Your Android app uses FCM. Former users and new users of your app normally receive the push notifications you send.
If the revision number is less than 6035, then some users will not receive your push notifications after April 11, 2019. To fix this, re-build your Android app and submit an update to the Play Store.
If the revision number is less than 6035, this is precisely what will happen after April 11:
- All users who downloaded the app before April 11, 2019 will continue to receive your push notifications correctly after this date.
Indeed, when they downloaded the app, GCM was still running. GCM has given them a token, and, good news, the tokens retrieved from GCM are compatible with FCM!
- For all users who download your app after April 11, 2019, your app will attempt to contact GCM for a push token. However, GCM will be off and the app will get no response :(
All these users will not receive your push notifications.
In summary, if you see a blue alert at the top of the pages of your backoffice, you must act.
Check with which version of the Android engine your app has been build.
If it's 6035 or higher, you have nothing to do.
If it's lower, re-build your app and submit an update.