I'm getting Push Notification problems: Error: Couldn't get GCM token for device

Hello everyone, I’m receiving this error while working with Expo. This is part of my package.json:

{

“dependencies”: {
“axios”: “0.18.0”,
“expo”: “^28.0.0”,
“jwt-decode”: “2.2.0”,
“lodash”: “4.17.10”,
“moment”: “2.22.2”,
“moment-timezone”: “0.5.21”,
“polished”: “1.9.2”,
“prop-types”: “15.6.1”,
“react”: “16.3.1”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-28.0.0.tar.gz”,
“react-native-dotenv”: “0.1.1”,
“react-native-modal-datetime-picker”: “5.1.0”,
“react-native-offline”: “3.11.0”,
“react-native-size-matters”: “0.1.2”,
“react-native-svg”: “6.3.1”,
“react-navigation”: “2.5.5”,
“react-redux”: “5.0.7”,
“redux”: “4.0.0”,
“redux-devtools-extension”: “2.13.5”,
“redux-persist”: “5.10.0”,
“redux-saga”: “0.16.0”,
“reselect”: “3.0.1”,
“styled-components”: “3.3.2”
},

}

As you can see, I’m using the latest version of Expo with its corresponding tools. Another thing that I did was making changes so FCM can work using this guide: Using FCM. I don’t know what else to do, it’s very frustrating.

Can you post your code here? It’s very hard to help you without that. A link to a Github project might work best.

I got “Error: Couldn’t get GCM token for device” as well.
I am just testing the push notification example on documentation, but it always throws Error: Couldn’t get GCM token for device when executing Notifications.getExpoPushTokenAsync().

I have tried both expo SDK25 SDK28 on android 8.0 and ios 10, and none of them can get GCM token.

Any thoughts?

Update:
Notifications.getExpoPushTokenAsync() works perfectly in my project after I start my project with expo start instead of react-natives-scripts start.

Same for me, I’m using the same code as the doc describes (copy, paste)
Using SDK 29.0.0.

– EDIT –
Just saw this response. Maybe this is the causing the issue.

1 Like

Thanks, your responses were very helpful. I didn’t know that CRNA could have problems with Expo notifications.

how did you fix it?
Tell me? please.

Hi. Instead of using the command react-native-scripts start I’m using exp start which is the CLI tool from Expo: https://github.com/expo/exp. Doing this, the function Notifications.getExpoPushTokenAsync is working well again. I’m afraid that CRNA is outdated (no new commits in the past two months: https://github.com/react-community/create-react-native-app/issues/722) and that’s the reason why we have problems with Expo using CRNA.

2 Likes

So i am having the same issue, ive created a feature 2months ago based on https://docs.expo.io/versions/latest/guides/push-notifications which it worked great. But apparently as ive attempted to check it today i am receiving the " [Unhandled promise rejection: Error: Couldn’t get GCM token for device] " error . I created a new project from scratch using

  "expo": "^28.0.0",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-28.0.0.tar.gz"

copy /pasted the code from documentation and run my app with exp start . But still i am getting the " [Unhandled promise rejection: Error: Couldn’t get GCM token for device] " error on

let token = await Notifications.getExpoPushTokenAsync();

. Can anyone assist me please ?:slight_smile:

@mits you should use exp start instead of react-native-scripts start. CRNA needs some updates to work again with Expo.

As i mentioned i used exp start but still the error occurs, and i dont know why.

Was able to resolve it by adding FCM details correctly. Thanks :slight_smile:

I’m getting this issue as well. Has anyone notified React Native devs of the issue?

Using exp start appears to have worked. I also added the information for my Firebase account, but I can’t tell which of those changes caused the app to work. I’m not building the app as an android app, just running it through Expo.

They said they used exp start and got the same issue…

I’m confused. What is an “Expo” project then? My react native app uses Expo… I don’t get what that means.

Im using exp start and still got problem :frowning:

thank you very much! works for me.

I’m also getting this error on Andriod. I’m using exp start and the code from the example. Is there a workaround, yet?

This solved my problems, thank you

@developer you also need to follow this FCM guide, it was very helpful for me.

1 Like

Thank you! Didn’t realize that that was required now. Everything seems to be working now.

1 Like