The article below explains why it may appear that your Push Notifications are not working on Android. It’s an article posted on Free Code Camp and written by Neil Mathew.
Push Notifications fail on specific Android phones. Here’s why.
I recently added support for Push Notifications in the Kayako App. I tested and shipped it. And I thought I did pretty good job.
But then one by one, my users start commenting that the the app doesn’t show any notifications about 95% of the time. At first, I thought it was a mistake because the Push Notifications were working as intended on my emulator and devices. But as I dug deeper, it became clear how serious and valid this problem was. This was but the tip of the iceberg. Close to 50% of our Android app users were affected but only few informed us about it.
So, what’s the problem?
Push Notifications are not working properly on specific Android phones.
I use the word ‘properly’ because users receive push notifications when the app is open but not when it is closed, which defeats the purpose of push notifications.
I use the words ‘specific Android phones’ because this issue is noticed only on phones by manufacturers like Xiaomi, Oppo, One Plus, Vivo, Lenovo, Huawei, Samsung, and a few others.
Why is this happening and how do we fix it?
To understand the problem, let’s first understand the Android UI and the expected behavior of Push Notifications.
On Android, we have three buttons at the bottom as part of the Navigation Bar. The square button, on click, opens the Recents screen. The Recents screen lists all the ongoing tasks or apps recently opened. We can clear these applications at any time, as shown below.
Yet on certain stock ROMs (Android operating system customized by device manufacturers), clearing an application kills that application and its background services. This is bad because we need background services to show Push Notifications.
When the server informs the Android device of a new Push Notification, it would normally re-start the application’s background services to show the notification to the user. That’s good because background services will automatically start to show push notifications.
The image below shows the expected behavior which is the case for vanilla ROMs. This is the original Android firmware that is not customized by manufacturers.
Click here for the complete article…
EDITORS NOTE (11/19/19): Here’s another article related to this issue… click here.