Android: cannot get getDevicePushTokenAsync due to non-valid Firebase project ID

I just started implementing push notifications - following the guides on So I created an Android app in my Firebase console and my app.json contains now a reference to the Google service file:

    "android": {
      "package": "",
      "googleServicesFile": "./google-services.json",
      "useNextNotificationsApi": true,

If I test this on a real android device (standalone app) I do not receive a valid token via this function:

          token = (await Notifications.getExpoPushTokenAsync()).data;

Instead I get the following error:

Error: Encountered an exception while calling native method: Exception occured while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google."

I guess it has something to do with the way of my project setup. I am also using “firebase” and hence created a web app in the Firebase console. In my application I initialize the Firebase web app with my web app configuration like this:

const FIREBASE_CONFIG: IFirebaseOptions = {
  apiKey: '--------',
  databaseURL: '',
  projectId: '--------',
  storageBucket: '',
  messagingSenderId: '--------',
  appId: '--------',
  measurementId: '',
  trackingId: '',

The FIREBASE_CONFIG as well as the google-services.json have the correct project ID. Do I need to initialize the Android App somehow?
I am using Expo SDK 40.0.1.

1 Like

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