I’m running an expo app in the bare workflow and am currently trying to get push messages to work on Android.
I can retrieve the ExpoPushToken strings from the phones perfectly fine, but when I try to actually send a push message I get the following error: “Unable to retrieve the FCM server key for the recipient’s app. Make sure you have provided a server key as directed by the Expo FCM documentation.”
I looked through the related threads, but none of the tips there seemed to help.
Things I already tried and checked:
The google-services.json file is downloaded to **./android/app/google-services.json". The expo.android.googleServicesFile key in app.json points there.
$ expo push:android:show returns the correct FCM API key
I tried to clear this and re-upload the key. I get a success message for storing the key, but still fail to push a message.
I tried to set the key through credentials manager. The upload works, the error message does not change.
I created an new server key in Firebase Console and tried that, but it also did not work
The package name in the Firebase console matches the key android.defaultConfig.applicationId in android/app/build.gradle and android.package in app.json
In the Google Cloud Console, I have enabled the Cloud Messaging, Firebase Cloud Messaging API, Firebase Installations API and FCM Registration API
I tried setting the “owner” property in app.json - it did not have any effect, I’m not on a paid plan but was desperate for ideas
I removed the app from the Firebase project and added it again.
I removed the whole Firebase project and re-created it. Still, same error message.
When you run expo push:android:show, it should print out something like:
Accessing credentials for <your username> in project <your project slug>
this combination of @username/projectSlug is what’s known as your “experience ID”, which is used both in expo-updates for OTA updates, and expo-notifications, and that’s what you should pass to getExpoPushTokenAsync
I’m running into the same issue with my project, but I am just calling getExpoPushTokenAsync() with no additional arguments. Is the experienceId only necessary in the bare workflow (I am using the managed workflow)? I tried similar things as above, and everything is uploaded correctly and works most of the time, but I get this as an intermittent failure. Are those tokens invalid or is this indicative of a bigger problem? Any insight here would be helpful.
For example, for one user, I only get this notification on 1 of his 3 expo tokens. Is there something wrong with that token? Should I delete tokens that return this error?