Notifications.getExpoPushTokenAsync() throwing "Couldn’t get GCM token for device"

When running this:

import { Permissions, Notifications } from 'expo'
// check for permission is 'granted' passes
const token = await Notifications.getExpoPushTokenAsync()

I’m getting this error in my standalone app (I see the message on Sentry):

Couldn’t get GCM token for device

I am checking for permissions with await Permissions.askAsync(Permissions.NOTIFICATIONS) and getting status: 'granted'.

This is for an Android standalone app on Expo SDK 32.0.0.

I have followed the steps to start using FCM and my app.json has the following in the android section:

      "permissions": [
        "CAMERA",
        "ACCESS_FINE_LOCATION",
        "ACCESS_COARSE_LOCATION",
        "READ_EXTERNAL_STORAGE",
        "READ_INTERNAL_STORAGE",
        "VIBRATE",
        "WAKE_LOCK",
        "READ_PHONE_STATE",
        "com.google.android.c2dm.permission.RECEIVE"
      ],
      "googleServicesFile": "./google-services.json",

Any ideas why I’m getting an error?

Hey @elie,

Just to make sure, did you upload your FCM key via expo push:android:upload --api-key your-token-here and also for clarity’s sake, this is a non-ejected project, correct?

I believe I did but I don’t remember for sure at this point. Is there a way for me to check?

And yes, I have not ejected.

It is also important to know that you need upload the keys from the same account as you use when you build the application. (Learned this the hard way :upside_down_face:)

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