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

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

Alas exp start didnt work for me either.
I’ve followed the FCM guide.

Strangely i can’t even request notifications permission anymore on iOS!
I get an “E_NOTIFICATIONS_TOKEN_REGISTRATION_FAILED” error, “Expo push notifications is supported only for Expo projects.”

I was originally using CRNA. Should i eject?

Anyone have any ideas?

Thanks

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