在Android的双推送通知服务 [英] Two Push Notification services in android

查看:215
本文介绍了在Android的双推送通知服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经集成解析SDK与我的项目已经实施解析推送通知和它的工作完美。
但问题是:
当我在我的项目整合的另一个推送服务,解析推停止工作?

I have integrated Parse SDK with my project already and implemented Parse Push Notification and its working perfectly. But the Problem is: When I integrate another Push Service in my project, the parse Push Stops working?

注意:

1.Parse使用自己的推送服务。

1.Parse uses its own push service.

2,新推我试图用使用GCM推送服务。

2.The new Push I tried to use use GCM push service.

有他们或之间的任何冲突是存在的,我们可以管理任何方式?

Is there any clash between them or is there any way we can manage both?

推荐答案

当您使用GCM广播接收器2 GCM客户在自己的项目 - 注册会从GCM服务器传来的封邮件的最后一个广播接收器。换言之 - 总是会有只有一个广播接收器,将得到这些封邮件。你的情况 - 您添加的接收GCM封邮件,因为它是最后一个注册的第二个服务,可能是处理它自己的留言并丢弃其他

When you use two Gcm clients with Gcm broadcast receiver in your own project - the last broadcast receiver registered will get the msgs coming from the Gcm servers. in other words - there will always be only one broadcast receiver that will get these msgs . In your case - the second service you added is receiving the Gcm msgs because it was registered last, probably handling it's own msgs and discarding the others.

在我的应用程序类似的类似的问题,我使用了用GCM封邮件一个lib和我的应用程序使用GCM为好。在应用程序的清单中添加服务和广播接收器后 - 的lib停止接受GCM封邮件

Had a similar similar problem in my app where I used a lib that used Gcm msgs and my app was using Gcm as well. after adding the services and broadcast receivers in the app's manifest - the lib stopped receiving Gcm msgs.

解决方案是不优雅 - 在广播接收机的的onReceive功能 - 我GCM封邮件区分针对我的应用程序和那些在我的广播接收器瞄准lib下,处理的那些我的应用程序,他们应该和的那些目标的lib - 我开始一个新的意图与额外的数据,由此引发的lib的广播接收机。因为我控制code为应用程序和lib这两个我可以采取这种方法。

The solution is not elegant - In the onReceive function of the broadcast receiver - I distinguished between Gcm msgs targeting my app and those targeting the lib in my broadcast receiver , handled the ones for my app as they should and for the ones targeting the lib - I start a new intent with the extras data , which triggered the lib's broadcast receiver. I could take this approach because I control the code for both the app and lib.

希望这有助于。

这篇关于在Android的双推送通知服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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