expo / expo-cli

Tools for creating, running, and deploying universal Expo and React Native apps
https://docs.expo.io/workflow/expo-cli/
2.6k stars 477 forks source link

Sending push notification for android when not signed in results in Error: Couldn't get GCM token for device #1389

Closed cruzach closed 2 years ago

cruzach commented 4 years ago

Description

If you're not signed into expo-cli, and you try to send an android push notification, you'll see an in the logs:

[Unhandled promise rejection: Error: Couldn't get GCM token for device]

Environment

Please run expo diagnostics in the project folder and copy the output here:

Also specify:

Reproducible Demo

Run the docs example - https://snack.expo.io/@charliecruzan/pushnotifications34?platform=ios locally, signed out of expo-cli and signed in

related - https://github.com/expo/expo/issues/5900

workaround is to just sign in to expo-cli

ucallQA commented 4 years ago

We have updated to use FCM from GCM a few months ago and several users still trigger this error in Sentry. We are certain they updated the app and are using FCM now, although we still see this error in production several months later

Expo Diagnostics: Expo CLI 3.11.1 environment info: System: OS: Windows 10 Binaries: Yarn: 1.17.3 npm: 6.9.0

Devices: Android 28, Android 29, Android 26

serhiipalash commented 4 years ago

The easiest way to reproduce this issue is to start your dev server in offline mode

expo-cli start --offline

and then open your project on real Android device via lan and try to get this device push token with

let token = await Notifications.getExpoPushTokenAsync()
kalebjdavenport commented 4 years ago

I am experiencing the same problem.

conka991 commented 4 years ago

Hi there, Im new on developing with expo, and Im facing the same as you described cruzach Im already signed in expo client.... the snack version of https://snack.expo.io/@charliecruzan/pushnotifications36?platform=android works fine but when I try to run it in local mode Im still getting "Error: Couldn't get GCM token for device" My current config is the following: Expo: CLI 3.2.3 System: OS: windows 10 x64 Binaries: Node: 12.11.0 Yarn: 1.21.1 npm: 6.9.1 IDEs: Android Studio: 3.5.3 Build #AI-191.8026.42.35.6010548, built on November 15, 2019 VsCode: 1.42.1 dependencies: "expo": "~36.0.0", "expo-google-app-auth": "^8.0.1", "expo-google-sign-in": "~8.0.0", "expo-permissions": "~8.0.0", "firebase": "^7.8.2", "react": "~16.9.0", "react-dom": "~16.9.0", "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz", "react-native-gesture-handler": "^1.6.0", "react-native-web": "~0.11.7", "react-navigation": "^4.1.1"

Any suggestion is welcome, thanks in advance

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.