问题
I'm using OnePlus 3 (7.1.1) There is one problem of not receiving notification when application is swiped from recent task (becomes dead) and then after if I push a notification from Firebase console, it won't receive any notification.
Any solution? Same bugs are on with vivo, oppo, huwai, xiomi, redimi, MI
And the same code works fine with Sony, Samsung moto.!
回答1:
You need to whitelist your app in the one plus settings. Chinese manufacturers block apps from running in the background. You would face a simillar situation in Xiaomi, Vivo, gionee, Oppo etc.
As for Xiomi ...go the security app ..auto start and allow your app to run in the background. This is a device specific thing and there is no code solution to it. You have to manually enable it. Hope it helps!
回答2:
Yes If you use any Xiaomi phone you have to enable the app to run in the background. -To Enable go to setting>Permisssions>autostart and select your app. and enable to autostart.
回答3:
Four things need to check to receive notification
- Auto Restart mode must be turn ON
- Background data
- Low Power Mode(Battar Saving mode)
- App's Notification Setting
vivo, oppo, huwai, xiomi, Redmi, MI all are Chinese vendors they customize stock android and blocks Auto Restart, Running in background mode.
For oppo I have fixed by implementing below steps
You can go to SECURITY CENTRE - PRIVATE PERMISSION - STARTUP MANAGER - add App to the STARTUP APPS ALLOWED
Go to SETTING - ADDITIONAL SETTING - APPLICATION MANAGEMENT - AUTOMATIC CLEANING -TURN OFF AUTOMATIC CLEANING
Go to SETTING - BATTERY - OTHERS - choose the app that you want to keep notification - turn off FREEZE BACKGROUND APPS
SETTING - NOTIFICATION AND STATUS BAR - MANAGEMENT NOTIFICATION - choose the apps - turn on PRIORITY NOTIFICATION
SETTING - BATTERY->Low Power Mode turn Off
来源:https://stackoverflow.com/questions/45602194/not-receiving-any-notification-from-fcm-firebase-cloud-messaging-when-applicatio