getExpoPushTokenAsync Fetching the token failed

Error: Fetching the token failed: Given string is empty or null

The app is asking for permission and after giving permission it is being ‘granted’ successfully. Next I am using let token = await Notifications.getExpoPushTokenAsync() to get the token but it returns anything.

working on expo but standalone app not working.

1 Like

I have same problem. help us

@rix_rudolph
I am using same code in expo docs. token creating in expo but not working standalone app.
Is it the same in your case?

yes, the standalone app gives me that error, I don’t really know how resolve it

1 Like

I get exactly this problem too. Works in expo client, works iOS stand-alone but does not work on Android stand-alone.

1 Like

an emergency problem for me and that needs to be resolved immediately.
I’m waiting for help from expo moderators.

1 Like

With android you must create app in firebase and write all app info,then connect with your project,
you can read this in documentation:::

Client Setup

  1. If you have not already created a Firebase project for your app, do so now by clicking on Add project in the Firebase Console.

  2. In your new project console, click Add Firebase to your Android app and follow the setup steps. Make sure that the Android package name you enter is the same as the value of android.package in your app.json.

  3. Download the google-services.json file and place it in your Expo app’s root directory.

  4. In your app.json, add an android.googleServicesFile field with the relative path to the google-services.json file you just downloaded. If you placed it in the root directory, this will probably look like

{
  ...
  "android": {
    "googleServicesFile": "./google-services.json",
    ...
  }
}

Finally, make a new build of your app by running expo build:android .

https://docs.expo.io//push-notifications/using-fcm

1 Like