【问题标题】:What intent actions are received when a message is sent?发送消息时会收到哪些意图操作?
【发布时间】:2017-03-09 23:04:07
【问题描述】:

当我从启用 Firebase 的项目发送消息时,会触发哪些意图操作?

我的清单如下:

<receiver android:name="com.test.testapi.MyPushReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
                <category android:name="com.test.androidtester" />
            </intent-filter>
        </receiver>

<service
        android:name="com.test.testapi.MyFirebaseMessagingService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>

我看到MyFirebaseMessagingService 被按预期调用,但是我也看到MyPushReceivercom.google.android.c2dm.intent.RECEIVE 意图操作调用。

是否保证 com.google.android.c2dm.intent.RECEIVE 将继续被 Firebase 调用?在 GCM 完全弃用之前,Google 可能会暂时保留此功能。

*注意:理想情况下,我希望将现有的MyPushReceiver 保留在我的清单中,以便与我支持的众多应用程序向后兼容,这些应用程序可能位于 FCM 或 GCM 上。

【问题讨论】:

    标签: android firebase google-cloud-messaging firebase-cloud-messaging


    【解决方案1】:

    这只是预期的行为。因为即使使用 FCM 发送消息,仍然具有 GCM 实现的设备/应用程序实例仍然能够接收消息。

    It's just compatible。您不必为了确保应用同时与 GCM 和 FCM 兼容而实现两个单独的服务。

    实际上没有办法判断是否保证(至少对我来说不是),但我想可以肯定地说它们将继续兼容 直到 Google 决定完全弃用它。

    【讨论】:

      猜你喜欢
      • 2014-03-01
      • 1970-01-01
      • 2011-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多