android - 如何在单个应用程序中实现多个 GCM 推送通知?

标签 android parse-platform push-notification broadcastreceiver google-cloud-messaging

我正在尝试实现两个第 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/

相关文章:

Swift - findObjectsInBackgroundWithBlock 总是返回 nil

ios - didReceiveRemoteNotification : is not called after notification arrives and app is in background/suspended mode

android - 如何防止 ProgressBar 卡住?

android - 使用两行文本创建一个自定义按钮,每行具有不同的字体

android - 如何在android中使用parse为特定组成员发送通知?

java - 错误 : cannot access Task class file for bolts

android - 据称随机获取 "No permission to send message to these tmIDs"HMS 推送服务

android - 我如何使用 Parse、Phonegap 和 phonegap-parse-plugin 接收通知?

Android GridVIew 根据方向更改列数

android - 没有在移动设备中收到我的 Android 应用程序的更新通知