I integrated Firebase Cloud Messaging in an Android app. App collects the FCM token and sends it to a remote server where tokens are stored in order to (eventually) send push notifications to users using FCM endpoint
https://fcm.googleapis.com/fcm/send
App gets the token in this way:
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
I noticed tokens come in two different formats.
The first format is a 152 characters string starting with xxxxxxxxxxx:APA91b
The second one is 140 characters string starting with APA91b
As far as I understood from this question Firebase Topic Message Received Status using Google API the first format is ‘new’ and the second one is ‘old’. But so far I couldn't find any correlation between token format and app version (and Firebase SDK Version) or Android API level.
The problem is that I can’t send a notification to the client with old format push token.
If I try to get token details using Instance ID endpoint https://iid.googleapis.com/iid/info I receive “InvalidTokenVersion” error.
What I would like to know is:
- why do clients with the same app version generate different token format?
- is there a way to use old format tokens or convert them to the new one?
Thanks