英文:
how I can wake up the device when send Firebase notification (FCM)
问题
当我的手机正在充电时,无论何时我发送 FCM 消息,它都会被唤醒。但是,如果手机没有连接充电器,直到我按下电源或主页按钮来唤醒手机之前,通知不会被接收到。
是否有任何方法可以使手机在没有连接充电器的情况下也能被唤醒?
我尝试过的方法:
- 从开发者选项中(将后台进程限制设置为最多 4 个)
- 发送 FCM 消息时不包含通知的 JSON 数据,只包含数据
- 添加并请求了以下权限:RECEIVE_BOOT_COMPLETED、WAKE_LOCK
英文:
when my mobile is in charging any time I send FCM it's wake up
but when it's not On charging the notification not received until I press the power or home button to wake up the mobile
is there any way to make it wake up even if it not charging
things I have tried:
- from developer options ( set Linit background process to 4 at most)
- FCM does not contain notification JSON when send it, only contain
data - added and requested this permission RECEIVE_BOOT_COMPLETED
WAKE_LOCK
答案1
得分: 0
【文档】1建议您发送高优先级消息以唤醒设备。
> FCM会尝试立即传递高优先级消息,允许FCM服务在必要时唤醒休眠设备,并运行一些有限的处理(包括非常有限的网络访问)。高优先级消息通常应该导致用户与您的应用程序或其通知进行交互。
另请参阅:
英文:
The documentation suggests that you are supposed to send a high priority message to wake the device.
> FCM attempts to deliver high priority messages immediately, allowing the FCM service to wake a sleeping device when necessary and to run some limited processing (including very limited network access). High priority messages generally should result in user interaction with your app or its notifications.
See also:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论