Firebase onMessageReceived凌空发布

时间:2018-01-30 14:13:21

标签: android firebase firebase-cloud-messaging

当我收到来自Firebase的消息时,我尝试发送消息(或启动服务)。像那样:

[...]
public void onMessageReceived(RemoteMessage remoteMessage) {
    send_message_via_volley();
}
[...]

当我的手机处于活动状态时,它正在工作,但是当屏幕关闭时 - 它会停止。 我还尝试使用PowerManager nad WifiManager来保持连接和CPU活着。 这有什么办法吗?

1 个答案:

答案 0 :(得分:-1)

只有在你的applciation处于前台状态时,才会调用 "paper-input": "~1.2.0", 。处于可见状态的手段。如果您的应用程序不可见或您的应用程序处于“后台”状态或已被杀死,则不会调用onMessageReceived()