简体   繁体   English

GcmListenerService 不工作

[英]GcmListenerService is not working

If I have both notification and data attributes in the payload, there is no call being made to GcmListenerService.如果我在有效负载中同时具有通知和数据属性,则不会调用 GcmListenerService。 Anyone knows why?有谁知道为什么? The current behavior is given below.下面给出了当前的行为。 1. Payload contains notification only: GCM takes care of notif display. 1. Payload 只包含通知:GCM 负责通知显示。 No call to listener 2. Payload contains data only: No default notif display.不调用侦听器 2. 负载仅包含数据:不显示默认通知。 But GcmListenerService is invoked.但是 GcmListenerService 被调用了。 3. Payload contains both notification and data: GCM takes care of notif display. 3. Payload 包含通知和数据:GCM 负责通知显示。 No call to listener.没有调用听众。

I need the listenerservice to be called to handle the scenarios when app is active and in foreground.我需要调用 listenerservice 来处理应用程序处于活动状态和前台时的场景。 Any idea how to get it?知道如何获得吗?

checkout link , it will help you to check, whether the application is in background or foreground.结帐链接,它将帮助您检查应用程序是在后台还是前台。 And then operate accordingly.然后进行相应的操作。

Tell me if i misunderstood.如果我误解了,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM