SDK34: Error: Couldn't get GCM token for device

Please provide the following:

  1. SDK Version: 34.0.0
  2. Platforms(ios/android/both): Android

I know there are a bunch of similar questions in the forums, but I am still looking for an answer. I am seeing the following a lot in our Sentry error logs:

Error: Couldn’t get GCM token for device

This is the specific line that causes it:

import { Notifications } from 'expo'

    const token = await Notifications.getExpoPushTokenAsync()

I have uploaded my FCM keys to Expo, but don’t understand why this error is still being thrown.

1 Like

Hey @elie,

Could you run expo push:android:show and make sure the FCM key was properly loaded and that it is both the correct one and still valid? Also, can you ensure that your device has Notif permissions granted.

Cheers,
Adam

I run it and get this:

{"status":"ok","fcmApiKey":"KEY"}

I ask for permissions using this:

const res = await Permissions.askAsync(Permissions.NOTIFICATIONS)

And only if res.status === 'granted' do I run:

const token = await Notifications.getExpoPushTokenAsync()

Which is where I’m seeing this error:

Error: Couldn’t get GCM token for device

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