In today’s mobile world, push notifications are very crucial for engaging users, keeping them updated, and bringing them back to apps. Whichever framework you work with, be it Flutter or React Native or native Android or iOS, the integration of Firebase push notifications is one of the best ways to go and developer-friendly as well.
This guide aims to walk you through enabling Firebase push notifications for Android and iOS, setting up Firebase Cloud Messaging (FCM), and sending your very first notification in simple steps that would suit both beginners and developers.
Why Use Firebase for Push Notifications?
Firebase Cloud Messaging (FCM) is free and reliable messaging service by Google for sending messages and notifications to app users on any platform.
Why is FCM a great choice?
- Free and scalable
- Supports Android, iOS, web
- Great integration with other Firebase tools
- Highly customizable targeting
- Secure token-based delivery
Once you set up Firebase push notifications, your mobile app can send real-time updates such as:
- Alerts and reminders
- App updates
- Promotions and offers
- Chat messages
System notifications
Prerequisites
Before we dive in, make sure you have:
- A Firebase account (console.firebase.google.com)
- A registered Android/iOS app
- Android Studio or Xcode installed
- Basic knowledge of mobile development
Step 1: Create a Firebase Project
- Go to the Firebase Console
- Click “Add project” and follow the steps
- Add your Android and iOS apps to the project
- Download google-services.json (Android) and GoogleService-Info.plist (iOS)
- Place these files into your app’s respective folders
Step 2: Add Firebase SDKs
For Android
- Add the Firebase BOM to build.gradle (project):
classpath ‘com.google.gms:google-services:4.3.15’
apply plugin: ‘com.google.gms.google-services’
dependencies {
implementation platform(‘com.google.firebase:firebase-bom:32.1.0’)
implementation ‘com.google.firebase:firebase-messaging’
}
- Initialize Firebase in MainActivity.java or your entry file.
For iOS
- Use CocoaPods to install Firebase Messaging:
pod ‘Firebase/Messaging’
- In AppDelegate.swift:
import Firebase
import FirebaseMessaging
FirebaseApp.configure()
Messaging.messaging().delegate = self
- Request user permissions:
UNUserNotificationCenter.current().requestAuthorization(…)
UIApplication.shared.registerForRemoteNotifications()
Step 3: Enable Firebase Push Notifications
From your Firebase project, go to Cloud Messaging → Settings and:
- Turn on push notifications for Android and iOS.
- Configure your APMNs key for iOS.
- Double-check that your google-services.json and GoogleService-Info.plist are in their designated locations.
By doing this, Firebase push notifications will become enabled in both Android and iOS and will register your app to receive FCM tokens.
Step 4: Get the Device Token
Each device is assigned a unique token used to send messages.
Android (Kotlin):
FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
val token = task.result
Log.d(“FCM Token”, token)
}
iOS (Swift):
Messaging.messaging().token { token, error in
if let token = token {
print(“FCM token: \(token)”)
}
}
Store this token on your backend to target specific users.
Step 5: Send Your First Notification
Open Firebase Console → Cloud Messaging → Send your first message:
- Title: “Hello User!”
- Body: “Your first push notification”
- Target: App package name or user token
Click Send, and if everything is configured correctly, you should see the notification pop up on your device.

Testing and Troubleshooting
- With tools such as Postman or Firebase Admin SDK, one may use these tools to send programmatic notifications.
- Make sure that the token on the device is the correct one.
- Check to see if the app has permissions for accepting push notifications.
- Use Firebase Logs to debug any errors.
Tips for Production
- Group users in topics (news, offers, etc.).
- Firebase Analytics can be combined for campaign insights.
- Handle notification clicks by routing users to the relevant page.
- Use data messages for handling in the background.
Real-World Use Cases
- E-commerce app sending sales alerts.
- Social app sending notifications for new messages.
- Finance apps sending notifications regarding transactions.
- Educational apps sending reminders for assignments or class start.
All of this is possible through Firebase push notifications.
Final Summary
In this guide, you’ve learned how to:
- Create a Firebase project.
- Add the needed SDKs.
- Enable Firebase push notifications on Android and iOS.
- Obtain device tokens.
- Send notification tests and real notifications.
- Troubleshoot delivery problems.
Push notifications are now ready on your mobile app for engaging users with real-time updates.