Push notifications are delayed in Android Doze mode

久未见 提交于 2019-12-12 11:19:36

问题


I am putting my Android device to sleep via adb:

adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step <-- repeat until state is IDLE

Then I am sending the following JSON:

{
   "to":"dYA7tVZrfag:APA91bFVqddVcJHnr_7ZhgNC5iu4Y6XKcLbSVD4DlZgfjMKwKvZhJHiKR4DIzpMrX8zUL15C_adfyEcrlI9q6zOFqFs_zwNPTVIDm-v20ZK0qgagKYGaQE1OPBqdH4P_JHYIXOIS3gfn",
    "priority": "high",
    "data":{
        "test0":"test0",
        "test1":"test1"
    }
}

Result: Nothing... until I wake up the device, then I get all the messages queued. I am monitoring if messages are coming by putting logs in the method onMessageReceived().

I googled around and some people say using an older version of Android Studio or upgrading the version (9.4.0) of the FCM SDK would fix the problem. I've done both with no success.

Edit: This problem seem to only happen with the Samsung Galaxy S5

来源:https://stackoverflow.com/questions/38907834/push-notifications-are-delayed-in-android-doze-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!