Android standalone app fails to get expo push token (fail to get GCM token)

Please provide the following:

  1. SDK Version: v37
  2. Platforms(Android/iOS/web/all): Android
  3. Tested on Android 7, 8, 9

I have been using Expo push notifications service very well for both Android and iOS for about two years. One week ago, some users told me they were not able to receive push notifications.

I found that only Android standalone app does not receive expo push token. When testing with Expo Client, my app receives expo push token well.

According to the Logcat in AndroidStudio following error occurs:
Error: Couldn't get GCM token on device.

I had already transitioned from GCM to FCM one year ago following your documentation: Using FCM for Push Notifications. Since I didn’t change any settings of FCM and FCM related thing in my project’s app.json for at least half year, it is likely that this is not related to FCM settings.

I am using Blaze pricing plan for Google Firebase. I thought Google might have changed their service. However, it is likely that there is not any kind of limit for FCM.

Is there anyone experiencing this kind of issue?

Following is a screen showing Expo Push Token. Normal app should show its token as below. But as of now, Android standalone app doen not show the token.

I solved this issue thanks to this thread:
SDK37 standalone app: “Couldn’t get GCM token on device”#7727

I added android.config.googleSignIn.apiKey to app.json as below:

{
  . . .
  "android": {
    . . .
    "config": {
      . . .
      "googleSignIn": {
         "apiKey": "API Key Here"
      }
    } 
  },
}

Note: apiKey has to be same as client.api_key.current_key in google-services.json downloaded from Firebase.

I tried expo publish but failed. So, I did expo build:android and released it to PlayStore’s internal test.
Wow, now my app receives expo push token. I finally released new version to PlayStore production.

I hope Using FCM for Push Notifications document include googleSignIn.apiKey should be added to app.json.

Later, as sjchmiela mentions in his final comments, just rebuilding was enough without adding android.config.googleSignIn.apiKey to app.json. :slight_smile:

I have a question I used expo sdk37
Android app crash
I catch the error is: ‘Casue: null pointer dereference’
Do you get this problem ?
Thank

No, I have never experienced the error in SDK37.

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