Search code examples
firebasegoogle-cloud-messagingfirebase-cloud-messagingdevicetoken

Differences between GCM and FCM devicetokens in format


I have an app running which has thousands of GCM-devicetokens. I want to upgrade to FCM, but the problem is that I cannot send notifications to GCM devicetoken with the FCM server. So for those users that has not updated the app I'll have to send notification through the GCM-server.

In the documentation (for google FCM-server) it says that I should be able to send to both GCM and FCM devicetokens. I am using Amazon SNS to send my notifications, and that might be the reason why I cannot use both tokens simultaneous

My question: Is it possible to distinguish between GCM-devicetokens and FCM-devicetokens? (by regex or by checking the format)


Solution

  • TLDR: There is no distinction.

    There was a change in the format of the token where the new (and current) format has a noticeable delimiter/separator, like so:

    <xxxxxx>:<xxxxxxxxxxxxxxxxxxxx>
    

    while the (really really) old format (IIRC, C2DM to early GCM days) is simply alphanumeric. But starting mid-late GCM days, this format was already applied.

    As was mentioned in Eran's answer before, sending to GCM tokens with an FCM server should be possible.