How to receive GCM message when app is closed or in background?

一世执手 提交于 2020-01-03 04:12:20

问题


When the App is in foreground, the GcmListenerService will be called and I can do performance here. But what if the app is in background? When the app is in background, I can still receive the notification but it is just the notification part without data part. How can I customize the on receive event to receive a GCM message when my app is in background or even closed??

the onMessageReceived() method will not be called if the app is in background. Is there any other method works when app is in background?


回答1:


https://github.com/google/gcm/issues/63

i have the same problem with him. And in this link there is a solution. When app is in the background, need server side to make a action. The data part will automatically saved in a intent and send to the activity contains that action in the content filter.



来源:https://stackoverflow.com/questions/36779661/how-to-receive-gcm-message-when-app-is-closed-or-in-background

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