0

当我从启用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被调用,但是我也看到MyPushReceiver被调用与com.google.android.c2dm.intent.RECEIVE意图动作。

确保com.google.android.c2dm.intent.RECEIVE将继续被Firebase调用?也许Google在这个过渡期间保持这个功能,直到GCM被完全弃用为止。

*注意:理想情况下,我希望将现有的MyPushReceiver保留在我的Manifest中,以便与支持FCM或GCM的许多应用程序向后兼容。

回答

1

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

It's just compatible。您并不需要实施两个单独的服务,以确保该应用程序与GCM和FCM兼容。

实际上,有没有办法判断它(至少是不适合我)保证,但我想这是肯定地说,他们将继续兼容,直到谷歌决定弃用这样的时间它完全。

相关问题