I am trying to setup push notifications for my expo react native app. Running in expo go everything works fine. Now for production I followed this Expo GUIDE.
The first 4 steps of this guide are reasonable.
But step 5 is very confusing:
google-service.json
file, how to reference it in the app.json
and to put it into .gitignore
. Which I have done.a) But this results in a warning: File specified via "android.googleServicesFile" field in your app.json is not checked in to your repository and won't be uploaded to the builder.
b) and finally in a failed build: "google-services.json" is missing, make sure that the file exists. Remember that EAS Build only uploads the files tracked by git. Use EAS secrets to provide EAS Build with the file.
So do I have to put the content of the google-services.json
file into an EAS secret? even though the guide mentions nothing about doing this and even says You're all set! You can now send notifications to Android devices via Expo Push Notifications using the FCM V1 protocol.
?
I encountered in the same issue and I solved in 3 steps:
Step 1:
Rename app.json
file to app.config.js
Note: use module exports to set the config the right way in .js file example:
module.exports = {
expo: {
//...rest of the configurations
android: {
//...rest of the configurations
googleServicesFile: process.env.GOOGLE_SERVICES_JSON,
},
}
}
Step 2:
Add the file google-services.json
into the project root folder.
Step 3: Run this command in the project root directory
eas env:create --scope project --name GOOGLE_SERVICES_JSON --type file --value ./google-services.json
Make sure if ./google-services.json
is the actual path to your google-services.json file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With