【问题标题】:How to implement multiple GCM push notifications in a single app?如何在单个应用程序中实现多个 GCM 推送通知?
【发布时间】:2015-04-01 02:53:24
【问题描述】:

我正在尝试实现两个使用GCM push 通知的第三方库(Parse & Localytics),但我似乎无法让两者一起工作。一个或另一个都行。

<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>

【问题讨论】:

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


    【解决方案1】:

    GCM 只知道您的应用,而不是 GCM 有效负载的内容。

    您需要一个通用接收器,它可以解析接收到的特定数据的意图,将其识别为 Localytics 或 Parse,然后将该意图转发给任一服务的相应接收器。

    GCM 是基于“应用注册”而不是“应用功能注册”——它将交付给您的应用,而不是您应用中的特定接收者。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多