如何在应用程序关闭或在后台接收GCM消息? [英] How to receive GCM message when app is closed or in background?

查看:126
本文介绍了如何在应用程序关闭或在后台接收GCM消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序处于前台时,GcmListenerService将被调用,我可以在这里执行性能。但如果应用程序在后台呢?当应用程序处于后台时,我仍然可以收到通知,但它只是没有数据部分的通知部分。如果我的应用程序处于后台或甚至关闭状态,我如何自定义on接收事件以接收GCM消息?



如果使用onMessageReceived()方法,则不会调用onMessageReceived应用程序在后台。当应用程序处于后台时,有没有其他方法可行? 解决方案

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



我有与他同样的问题。在这个链接中有一个解决方案。当应用程序在后台时,需要服务器端进行操作。数据部分将自动保存在意图中,并发送给包含内容过滤器中该操作的活动。


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?

解决方案

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.

这篇关于如何在应用程序关闭或在后台接收GCM消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆