Error: Couldn't get GCM token for device

#1

I’ve seen these occasionally in my bug reports, has anyone encountered the same?

Error: Couldn’t get GCM token for device

This is on SDK24 and various Android phones and Android versions.

The code in question shows it’s mExponentSharedPreferences.getUUID() returning null:

    String uuid = mExponentSharedPreferences.getUUID();
    if (uuid == null) {
      // This should have been set by ExponentNotificationIntentService when Activity was created/resumed.
      promise.reject("Couldn't get GCM token on device.");
      return;
    }

Anyone have any thoughts or remedies?

Thanks

#2

Hi @mlight, the notifications have had many updates and improvements since SDK 24. It could be that updating to a more recent SDK (28 will be arriving soon!) will solve your problems.

@ide – do you know anything about this from SDK 24?

#3

I’m not familiar with this issue but it looks like it could happen if shared preferences gets cleared on the device (maybe a user chose to clear their data)?

closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

#5

For those who encounter this, ensure you have run expo login before trying to fetch a token. Special thanks to Eric Butler for providing the answer and looking out for the community.

1 Like