Android
Configuring Expo Push Notifications for Android
Steps
Set up Firebase Cloud Messaging (FCM)
- Follow the instruction described here to add Google Service Account
Make sure to add the role to your service account before uploading it to expo.dev credentials :
- Make sure to use the same package name as your defined in your
config.ts
- Download the
google-services.json
file intoapps/myapp/
directory
Build with gitignored google-services.json file
The google-services.json
file should not be committed to your repository, which is why it's listed in the .gitignore
file.
However, this can cause local builds to fail. The best practice is to store this file in EAS secrets. You can do this using the following command:
Make sure in app.config.ts you have the following :
Implement push notification handling
The project is pre-configured to present the user with a permission dialog when the user is first connected.
You can also trigger the permission dialog by calling setAppPreferences
anywhere in your code :
Run your application on a device; simulators are not supported.