Device Specific Issue in Receiving Push Notification when App is killed/closed - android

Lenevo Mobile not receiving push notification when App is Closed/killed. I have analysed this issue for long time. Tried solutions like removing app from Optimize app List. etc. Please Help me out.

Lenovo/vivo and some other manufacturers have auto-start feature that disables most apps(except of whitelisted apps like facebook) to start in background, try giving your app permission to auto-start manually in settings

Related

How is it Instagram shows heads-up notifications when app is in background?

As far as I googled if an app is in background notifications drop in a tray and can't be shown as heads-up overlaying all other apps. But yet instagram notifications overlay other apps even when instagram not in the foreground. How do they do this? I managed to show heads-up notification on emulator but only when my app is in the foreground and couldn't do the same on my real device (Huawei). Android on device and emulator are the same - 5.1
Can it be connected with a source of notifications? I am using firebase console to send notifications. Probably it's firebase restriction and I should switch to onesignal or another provider?
Also, are heads-up notification can only be singleline, or I can somehow enable multiline mode?
Please, give me working code for heads-up notifications when app is in the background. I already tested everything I could find on StackOverflow on the matter.
That might be the case of OS force closing background services. Some manufacturers like Huawei, Xiaomi etc, do that intentionally to enhance battery life. But for apps like Instagram and Whatsapp, manufacturers whitelist these apps.
To whitelist any App you have to change settings from the device itself.
To change settings for your app here is the link.

Firebase push notification issue in Android when app is closed/killed

Firebase push does not work on some devices when app is closed with only data payload. See this thread: https://github.com/firebase/quickstart-android/issues/41
I know when app is killed by swipe then some OEM kill all the services of the app which directly effect FirebbaseMessagingService and due to this onMessageReceived() method never invoked. I have also tried with high priority FCM but sadly no success. Here are the phones on which I am facing an issue: OnePlus, Lenovo, Huawei.
Currently, I am testing with OnePlus 5, when I change the battery setting to "Don't Optimise" then push notification started working.
I killed the app and run dumpsys package MY-PACKAGE | grep stopped command and I found that app is not stopped. It shows stopped=false. It means app is running.
The concept of push notification is to notify users when app is closed but currently, we are unable to do.
Any suggestion how can I fix this?
FirebaseMessagingService can receive PushNotification even when app is closed/killed.
But there are some problems in the way. The behavior of the apps changes between development and production, and because of the device provider.
The first thing you have to consider, is when the app is in development, if you force close the app (kill-process), FirebaseMessagingService stop being triggered. But this doesn't happen in production, so don't be aware of this if your APK is signed. link to source
The second thing, is that there some Android phone providers that manage processes by them selfs. We can see an example like Huawei phones and their "Protected applications", which make user decide if want to protect the app or not. Only famous apps are protected on installation like WhatApp or Twitter... link to source
At this point, your FirebaseMessagingService should be triggered, but there are other problems related with memory and processes managed by system (OS). Your Service can be canceled because of the time that it's spending to handle the PushNotification. You can find many ways to handle this problem, but the best way, is Firebase JobDispatcher. link to source

Never receive FCM notification if the phone was in energy saving mode at the time it was sent

I am developing an Android app whose main use is to be notified instantly of certain events.
I have a Huawei phone.
The app works well with FCM
I receive notifications in foreground and background, from FCM console and also from my server (PHP code)
The problem is:
I put my phone in ultra power saving mode.
After that I send a notification. FCM return success operation.
Finally I change my phone back to normal mode
I Never receive the notification. Not even if I open my app.
I already check my app in "Protected Apps"
I want to know how to fix this issue. It's an Android bug? It is only a problem of this device? I mean... I do not think my code is wrong... the problem is how the OS manage FCM, google play services or whatever... there is a solution? OR an alternative cloud message service that works well? Other apps like Whatsapp doesn't have this problem.
Thanks in advance

Not receiving GCM push notification in MI phone if app is killed

I integrated GCM in my project to receive push notification from server. I am able to successfully receive push notification in all the devices (Nexus, Samsung etc), however, I am not receiving notifications on my Xiaomi MI phone.
When the app is running or is in background then I am receiving notification however if I kill the app (by swiping the app away from recent apps) then I don't receive any notification.
In pre-installed Security app there is an Auto-Start feature. Some apps have this auto-start feature turned ON and some don't. My app have this auto-start feature turned OFF. If I turn auto-start ON for my app then I start receiving notifications even if I kill the app.
How can I fix this issue? Please help me out.
Start AutoStart
Open Security App -> Permissions -> Auto Start Management.
Add/Enable your app as auto start apps
Start Lock Screen Notification
Open Settings App -> Notifications - Manage Notifications.
Tap on your App and select all cases.
i got success with this.. Hope it helps..

Android 5 Asus ZenFone 2 blocking push notifications when app close

I have been testing my app on an Android 5 ZenFone 2. This phone contains a piece of Asus software called autostart manager.
Some detrimental scenarios for my cordova app:
After app is installed autostart manager automatically denies it autostart. The big problem here is that the app doesn't receive push notifications when it is neither running in foreground or background. If the user kills the app from task manager then no more notifications (unlikely what the user desires).
The app appears to be killed automatically a few mins after being placed in the background. I am assuming this is autostart trying to conserve memory. Again no push notifications.
My app is functionally reliant on being able to receive push notes when not in foreground.
I reckon most average users are not aware that their apps may not be receiving push and therefore not fully functional.
I am wondering:
Are there autostartmanager equivalents for other Android devices doing the same thing?
Is it possible to beat this software and allow push notification always to be received by editing manifest configuration?
I believe there is no way too make push notifications work unless you app is marked as "allowed" to start in the Autostart Manager.
There are a lot of app like the Asus Autostart Manager in the Play Store, but generally a user needs to explicitly install one, while the Asus one is preinstalled and non-removable (at least it starts again after the next update which happens quite often for Asus).
I was facing the same problem.
Go to -> Sound & Notification -> Notification access -> Enable for ZenUI Launcher.
Go to -> Apps and enable notificatio

Categories

Resources