FCM’s device token & GCM’s

less than 1 minute read

FCM’s device token is same with GCM’s device token because FCM includes GCM. But FCM’s token has more information than GCM’s. So if you want to convert FCM’s token to GCM’s, do something.

String fcmToken = FirebaseInstanceId.getInstance().getToken();
String gcmToken = fcmTocken.substring(fcmTocken.indexOf(':') + 1);

// fcmToken.equals("dtvc2g3nsrc:APA91bGEPZlxgZoh7sV9HROrPtOA8R2oQKB_u3LZr1QeX9Q9MW7UBqxmO73FPXppUUEpVaWcP35WdsZLHZV-tsFSdaKTZfSJV4c5E-yuVUCv3TDkaPPBovDiAU8v5xE0ANq7-47iqObS") == true;
// gcmToken.equals("APA91bGEPZlxgZoh7sV9HROrPtOA8R2oQKB_u3LZr1QeX9Q9MW7UBqxmO73FPXppUUEpVaWcP35WdsZLHZV-tsFSdaKTZfSJV4c5E-yuVUCv3TDkaPPBovDiAU8v5xE0ANq7-47iqObS"_ == true;

Leave a Comment