0

When I send a message from a Firebase enabled project, which intent actions get fired?

My Manifest is as follows:

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

I see that MyFirebaseMessagingService gets called as expected, however I also see that MyPushReceiver gets called with the com.google.android.c2dm.intent.RECEIVE intent action.

Is it guaranteed that com.google.android.c2dm.intent.RECEIVE will continue to get called with Firebase? Perhaps Google kept this functionality in the interim until GCM becomes fully deprecated.

*Note: Ideally I would like to keep the existing MyPushReceiver in my Manifest for backward compatibility with numerous apps that I support that could be on either FCM or GCM.

AL.
  • 36,815
  • 10
  • 142
  • 281
David Truong
  • 462
  • 4
  • 13

1 Answers1

1

This is just expected behavior. Since even when using FCM to send the messages, devices/app instances that still have GCM implementations would still be able to receive the messages.

It's just compatible. You don't really have to implement two separate services just to make sure that the app is compatible with both GCM and FCM.

There's actually no way to tell if it is guaranteed (not for me at the very least), but I guess it's safe to say that they will continue to be compatible until such time that Google decides to deprecate it completely.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281