怎样在发送Firebase通知(FCM)时唤醒设备。

huangapple go评论104阅读模式
英文:

how I can wake up the device when send Firebase notification (FCM)

问题

当我的手机正在充电时,无论何时我发送 FCM 消息,它都会被唤醒。但是,如果手机没有连接充电器,直到我按下电源或主页按钮来唤醒手机之前,通知不会被接收到。

是否有任何方法可以使手机在没有连接充电器的情况下也能被唤醒?

我尝试过的方法:

  1. 从开发者选项中(将后台进程限制设置为最多 4 个)
  2. 发送 FCM 消息时不包含通知的 JSON 数据,只包含数据
  3. 添加并请求了以下权限: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:

  1. from developer options ( set Linit background process to 4 at most)
  2. FCM does not contain notification JSON when send it, only contain
    data
  3. 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:

huangapple
  • 本文由 发表于 2020年9月11日 22:40:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/63849263.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定