Back to Labs Content
- Frontend
- Android
- Mobile App
- React Native
How to Set Up Push Notifications in Expo with Firebase for Android (Production-Ready Guide)
Saturday, May 17, 2025 at 6:16:38 PM GMT+8
Push notifications are one of the most powerful ways to engage users in your mobile app. When building apps using the Expo managed workflow, Expo provides a convenient API to send and receive push notifications. However, when targeting Android devices in production, you need to configure Firebase Cloud Messaging (FCM) properly — particularly using FCM V1, which is now the recommended and secure approach.
How it Works?

Push notifications rely on a unique identifier called a push token to deliver messages to the right device. In the Expo ecosystem, as shown in the diagram, this process starts when your backend sends a notification. For example, imagine someone likes Brent's puppy photo and wants to notify him with a message like "Puppy!" The backend constructs a payload that includes Brent's Expo push token (e.g., "ExponentPushToken[I22V7M...]"), the message "Puppy!", and additional data like the photo ID. This push token, which Expo generates for each device when the app registers for notifications, acts as a device-specific address. Expo's push notification service receives this payload and uses the token to determine the target device. If Brent's device is Android, Expo forwards the notification to Firebase Cloud Messaging (FCM); if it's iOS, it routes to Apple Push Notification Service (APNS). The respective service then delivers the "Puppy!" notification to Brent's device, ensuring he gets the message. This guide will walk you through setting up this process for Android using Expo and Firebase.
Getting Started with Expo Notifications
First, make sure your project is set up correctly. If you're starting from scratch, create a new Expo project and install the notifications package:
npx create-expo-app my-app
cd my-app
npx expo install expo-notifications
Inside your app, you’ll need to request push notification permissions and fetch the Expo push token. This token is what uniquely identifies each device and allows Expo to send notifications to it. Here's a basic helper function to handle this setup:
import * as Notifications from 'expo-notifications';
import * as Device from 'expo-device';
export async function registerForPushNotificationsAsync() {
if (!Device.isDevice) return null;
const { status: existingStatus } = await Notifications.getPermissionsAsync();
const finalStatus = existingStatus === 'granted'
? existingStatus
: (await Notifications.requestPermissionsAsync()).status;
if (finalStatus !== 'granted') return null;
const token = (await Notifications.getExpoPushTokenAsync()).data;
return token;
}
Setting Up Firebase Admin SDK Credentials
To send notifications on Android devices, Expo communicates with Firebase Cloud Messaging (FCM) on your behalf. To enable this securely, you need to provide Expo with Firebase Admin SDK credentials, which come in the form of a JSON file.
Go to your Firebase Console, open your project, and navigate to Project Settings > Service Accounts. Click on “Generate new private key”, which will download a JSON file. This file includes the necessary authentication information Expo uses to send push notifications via the FCM V1 API.
It’s important to note that this is not the same as the google-services.json file used for initializing Firebase in Android apps. The Admin SDK JSON is a private key meant for server-side use and should be kept secure.
Uploading Credentials to Expo
Once you have the Firebase Admin SDK JSON file, you need to upload it to Expo. This allows Expo to authenticate with Firebase when sending push notifications to Android devices.
If you're using the latest Expo toolchain, the recommended way to do this is with eas:
eas credentials -p android
During the prompt, choose the option to Upload FCM V1 service account key, and select the Admin SDK JSON file you downloaded earlier. Alternatively, if you're still using the classic Expo CLI, you can run:
npx expo push:android:upload --firebase-json ./firebase-adminsdk.json
This upload is a one-time setup unless you rotate your Firebase keys.
Configuring app.json or app.config.js
To complete the setup, you also need to configure your app.json or app.config.js to inform Expo about the notification settings and include your google-services.json file, which is still required for Android builds.
Here’s an example configuration:
{
"expo": {
"android": {
"googleServicesFile": "./google-services.json",
"useNextNotificationsApi": true
},
"notification": {
"icon": "./assets/notification-icon.png",
"color": "#ffffff"
},
"plugins": [
"@react-native-firebase/app",
"@react-native-firebase/messaging"
]
}
}
This tells Expo to include the required Firebase files and notification settings in your Android build. The "useNextNotificationsApi": true flag ensures that Expo uses the newer Android notification APIs, which are compatible with Firebase’s latest messaging platform.
Sending Push Notifications
With everything configured, your app will be able to register for push notifications and receive an Expo push token. To send a notification, you can use Expo's hosted API endpoint:
POST https://exp.host/--/api/v2/push/send
Send a POST request with a JSON payload like the following:
{
"to": "ExponentPushToken[xxxxxxxxxxxxxx]",
"title": "Hello!",
"body": "This is a test push notification."
}
You can send this request using any HTTP client like axios, fetch, or even from your backend server. The Expo push service will handle communication with Firebase for you, using the credentials you uploaded earlier.
When Is Firebase Admin SDK Needed?
To clarify, the Firebase Admin SDK is not required in your app code or for sending notifications manually. It’s only needed during the one-time credential upload process so that Expo can authenticate with Firebase’s FCM V1 API. You don't need to include it in your frontend app or backend unless you're planning to send notifications directly via Firebase without going through Expo.
Final Thoughts
Using Expo’s push notification system with Firebase is straightforward once the initial setup is done. The key steps are generating the correct Admin SDK credentials, uploading them securely via eas, and properly configuring your project with both the firebase-adminsdk.json and google-services.json files.
By following this process, you can deliver reliable and scalable push notifications to your Android users while keeping your setup clean, secure, and aligned with Firebase's best practices.
Another Recommended Labs Content
Creating a Reusable React Layout Package via GitHub (Without npm Publish)
If you often reuse the same Navbar, Footer, or other layout components across multiple React projects, maintaining them in each repo becomes redundant and error-prone. A better approach is to extract them into a shared GitHub package.
The concept of splitting a frontend into smaller, manageable pieces.
Have you ever worked on a massive frontend application where every change felt risky and deploying updates took ages? If so, micro frontends might be the solution you’ve been looking for
In today's fast-paced digital landscape, applications are becoming increasingly complex and distributed. To manage this complexity and ensure high availability, reliability, and scalability, organizations are turning to Kubernetes. This powerful container orchestration platform has revolutionized the way we deploy and manage applications.