我正在尝试实现两个第 3 方库 (Parse & Localytics)
,它们使用 GCM push
通知,但我似乎无法让两者一起工作。两者都行得通。
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</receiver>
<receiver android:name="com.localytics.android.PushReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</receiver>
最佳答案
GCM 只知道您的应用程序,而不是 GCM 负载的内容。
您需要一个通用接收器,它可以解析接收到的特定数据的 Intent ,将其标识为 Localytics 或 Parse,然后将该 Intent 转发给任一服务的适当接收器。
GCM 基于“应用程序注册”而不是“应用程序功能注册”——它将传送到您的应用程序,而不是您应用程序中的特定接收者。
关于android - 如何在单个应用程序中实现多个 GCM 推送通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29382084/