首页 > 解决方案 > 在深度打盹模式测试中未收到 FCM 高优先级消息

问题描述

我开始使用以下命令在深度打盹模式下测试应用程序:

$ adb shell dumpsys battery unplug
$ adb shell dumpsys deviceidle force-idle
$ adb shell dumpsys deviceidle get deep

最后一个检查设备是否处于空闲状态的命令。

当高优先级推送发送到设备时,应用程序会显示全屏意图通知以显示呼叫屏幕。

最初收到推送并显示屏幕,但在 3-5 次推送后未收到。此外,当我看到日志时,它显示以高优先级接收推送,但降级为正常:

Priority: 2 
Original Priority: 1 

onMessageReceived(remoteMessage: RemoteMessage)使用方法中:

remoteMessage.priority
remoteMessage.originalPriority

这些是呼叫邀请高优先级推送,因此 ttl 为 0。

请帮助我了解以下内容:

  1. adb 命令是否$ adb shell dumpsys deviceidle force-idle不利于测试并使测试结果错误?
  2. 全屏意图是否不能防止桶填充降低优先级,就像我们的例子一样?
  3. 有没有办法处理它,以便应用程序每次都收到高优先级推送,即使在打盹模式下也是如此。

标签: androidpush-notificationfirebase-cloud-messagingandroid-doze

解决方案


推荐阅读