'Expo Push Notifications on Android

I have Expo Push Notifications working in the Expo Go app as well as iOS builds. However, it does not work on Android and I get this message when running getExpoPushTokenAsync():

Error: Encountered an exception while calling native method: Exception occurred 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 have followed all the steps listed in the documentation: my google-services.json is referenced in app.json and I double checked all the information there, including the project ID.

I tried to get the native device token via getDevicePushTokenAsync() and it worked, however even if I want to use the firebase notifications without Expo I get the same error further down when trying to set a firebase notification listener.

The problem may be linked with the fact that a firebase app is already running with the JS SDK (for realtimeDB and stoage) using other configs when I call getExpoPushTokenAsync(), I could maybe initialize a secondary Firebase App with the google-services.json config (which works, I tried it) but I do not see any way to force Expo Notifications to use this app.

Any idea of what is going on? Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source