- Android push notifications are disabled by default until you complete the setup process in this guide.
- iOS push notifications are already enabled if you selected “yes” to enabling push notifications during your first development build.
Step 1: Service Setup
Before implementing push notifications in your app, you need to set up the necessary services for each platform:Android push notifications are disabled by default in the boilerplate. Follow this guide to enable them for your app.
1
Create a Firebase Project
- Go to the Firebase Console
- Click “Add project” (or use an existing project for your app)
- Follow the prompts to create and configure your project
2
Generate Service Account Key
- In the Firebase console, open Project settings > Service accounts
- Click “Generate New Private Key”, then confirm by clicking “Generate Key”
- Securely store the downloaded JSON file containing the private key
3
Upload Service Account Key to EAS
Using EAS Dashboard
- Go to your Expo project dashboard
- Pick your account and project
- Scroll down to Credentials under Project settings in the menu on the left
- Under Android, find your Android Application Identifier - your package name from
app.json
- Click on it
- Under Service Credentials > FCM V1 service account key, click Add a service account key
- Under Upload new key, upload your JSON credential file and click Save
Note: Copy your SHA-1 fingerprint from the Android upload keystore table
4
Add Android App to Firebase & Download Configuration File
- In the Firebase Console, go to your project and click Add app and select Android
- Enter your Android package name (found in your
app.json
) - For the App nickname, you can use your app name
- Paste your SHA-1 fingerprint from the Android upload keystore table from the last step
- Register the app and download the
google-services.json
file
- Enter your Android package name (found in your
- Save the
google-services.json
file- Put it in your project’s main folder (where your
package.json
orapp.json
files are)
- Put it in your project’s main folder (where your
- Just skip the rest of the flow in Firebase
- Skip Add Firebase SDK and Next steps
Note: This is a sensitive file that should not be tracked by git. Make sure it is added to your.gitignore
file, but not in the.easignore
file.
Step 2: Implementation
Follow the implementation instructions in theintegrations/push/README.md
file included in your boilerplate codebase. This file contains all necessary steps for integrating push notifications in your application, including:
- Code configuration
- Integration of the
google-services.json
file - Required app.json settings
- Build instructions
Step 3: Testing Notifications
Local Testing
The boilerplate includes a built-in notifications demo that makes testing easy:- Open your development build
- Navigate to the
Account
tab - Select
Notifications
settings - Tap on
Test Push Notifications
- Follow the on-screen instructions to send and receive test notifications
External Testing with Expo
For testing push notifications from an external source without backend setup:- Get your Expo push token from the app’s test notification screen
- Visit expo.dev/notifications
- Enter your token and compose a test message
- Send and verify delivery on your device
Step 4: Backend Integration
1
Set Up Supabase Database
Create a
device_tokens
table with:id
,user_id
,token
,platform
,created_at
,updated_at
- Set appropriate RLS policies
2
Register Tokens
Modify lib/notifications/useNotification.ts to send the Expo push token to Supabase when:
- A user logs in
- The token is refreshed
3
Create Notification Service
Build a backend service using:
- Supabase Edge Functions or a separate server
- Expo Server SDK for sending notifications
4
Token Management
Implement logic to:
- Update tokens on device changes
- Remove invalid tokens based on receipts
Step 5: Backend Testing
1
Create Test Endpoint
Build a secure function to:
- Query user’s tokens from Supabase
- Send test notifications
2
Monitor Delivery
Track notification statuses and handle failures
Best Practices
Security & Performance
Security & Performance
- Use RLS policies for token protection
- Implement authentication for sending endpoints
- Add database indexes for efficient queries
- Batch notifications for multiple recipients