Migrating from gcm to fcm on Android

I want to switch from gcm to fcm in an android application. Do I need to send a push notification to old users of the Android application from gcm or can I send it via the new fcm from the server?

FCM works fine, I can receive push notifications on my device through fcm, but I can not send push notifications to old GCM tokens from the FCM console.


Below is the code I added to the manifest file for fcm to work -

<uses-permission android:name="com.google.android.z.permission.RECEIVE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <application> <service android:name=".view.activity.MyFcmListenerService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <service android:name=".view.activity.MyInstanceIDListenerService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> </application> 
+7
android firebase firebase-cloud-messaging google-cloud-messaging
source share
4 answers

I searched a lot, but could not find a satisfactory answer. So, I applied this fix.

I continue to use the old method that I used to send push notifications to GCM users and for users who register through FCM, I can send them push notifications through the FCM console or Firebase Notification.

PS You cannot send a push notification to GCM registration tokens through FCM.

+1
source share

I think you can send it through FCM. To learn more about FCM, you can check the GCM FAQ for FCM . Also, if you start migrating from GCM to FCM, you can follow these tutorials:

Also for more information you can check this SO question .

+1
source share

It actually works. FCM and GCM are under the same hood. For FCM, a token for GCM is also used. All you have to do is change your client-side implementation, as indicated here . and upgrade the server endpoint to fcm.googleapis.com/fcm/

0
source share

I made a POC in the same scenario, and what I observed is shown below

"There is no need to change the code on the client side when you try to transfer GCM to FCM, and I tested both on Android and iOS. It works fine. Only changes require the correct configuration in the FCM console (that is, specify the correct package identifier and identifier project (senderid)) "

0
source share

All Articles