Complete Beginner’s Guide to Setting Up Push Notifications in iOS & Android Using Firebase

Push Notifications are essential for modern apps — whether you're reminding users of a new message, sending a promotional offer, or alerting about important updates. In this blog, we’ll walk you through setting up push notifications for both iOS and Android using Firebase, in a way that even freshers can follow.

Push Notifications are essential for modern apps — whether you're reminding users of a new message, sending a promotional offer, or alerting about important updates. In this blog, we’ll walk you through setting up push notifications for both iOS and Android using Firebase, in a way that even freshers can follow.

What Are Push Notifications?

Push notifications are short messages sent from a server (like Firebase) to a user's device, even when the app is not open. They help keep your users engaged and informed in real-time.

Tools and Services We'll Use

Tool/Service Description
Firebase Cloud Messaging (FCM) Google’s cross-platform messaging solution to send notifications. It's FREE and supports both iOS and Android.
Xcode Apple’s official IDE (Integrated Development Environment) for building iOS apps.
Apple Developer Portal Platform for managing Apple apps, certificates, and identifiers. Required for enabling push on iOS.
Keychain Access A macOS tool for managing digital certificates. Helps generate the certificates required by Apple for push notifications.

 

iOS Push Notification Setup

 

Step 1: Create a Bundle Identifier in Xcode

What is it?
A unique string used to identify your app on the Apple ecosystem (e.g., com.companyname.appname)

 

How to do it:

  • Open your project in Xcode.

  • Go to your project in the left navigator.

  • Select your Target > General tab.

  • Under Identity, set a Bundle Identifier.

Step 2: Enable Push Capabilities in Xcode

Why?
Push Notifications won’t work unless you explicitly enable the capability in your app project.

 

Steps:

  1. Go to Signing & Capabilities.

  2. Click “+ Capability”.

  3. Add:

    1. Push Notifications

    2. Background Modes

      • Check Remote notifications and Background fetch

 

Step 3: Generate APNs Certificates Using Keychain

What is APNs?
Apple Push Notification service (APNs) is Apple’s system that delivers notifications to iOS/macOS devices.

 

Why Keychain?
To communicate with APNs, Apple requires a certificate proving your app’s identity.

 

Steps:

  1. Open Keychain Access (use Spotlight or Launchpad).

  2. Go to:

Keychain Access → Certificate Assistant → Request a Certificate From a Certificate Authority
 

     3. Fill the form:

  • User Email Address: Your Apple ID

  • Common Name: e.g., MyApp Push Certificate

  • Leave CA Email Address empty

  • Choose “Saved to Disk”

 

This will generate a .certSigningRequest file — this file is needed in the Apple Developer portal.

 

Step 4: Configure Certificates in Apple Developer Portal

Why?
To allow your app to receive push notifications, you must register it and configure certificates on Apple’s platform.

 

Steps:

  1. Go to Apple Developer Console

  2. Navigate to Identifiers

  3. Click “+” to create a new App ID using your Bundle Identifier

  4. Enable Push Notifications

 

Then:

  1. Scroll down to Push Notifications

  2. Under both Development and Production, click Configure

  3. Upload the .certSigningRequest you created

  4. Download the resulting .cer files

 

Step 5: Export .p12 Certificates from Keychain

What is a .p12 file?
It’s a secure file format that bundles your push certificate with a private key. Required by Firebase to send notifications via APNs.

 

Steps:

  1. Double-click downloaded .cer files — they’ll be added to Keychain

  2. In Keychain:

    • Go to My Certificates

    • Locate both Development and Production certificates

    • Right-click → Export

      Save as
      • Dev-certificate-FCM.p12
      • Prod-certificate-FCM.p12

 

Step 6: Configure Firebase for iOS

Why Firebase?
Firebase Cloud Messaging (FCM) will act as the server that sends notifications to your iOS and Android devices.

 

1. Create Firebase Project

  1. Go to Firebase Console

  2. Create a project

  3. Add an iOS app

    • Use the same Bundle Identifier

  4. Download GoogleService-Info.plist

 

Drag this file into your Xcode project’s root folder.

 

2. Initialize Firebase in Xcode

Add Firebase configuration in your app's startup file:

 

import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication,
                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    FirebaseApp.configure()
    return true
  }
}
 

 

3. Upload .p12 Certificates to Firebase

  • Go to Project Settings > Cloud Messaging

  • Scroll to your iOS app under APNs Authentication Key

    • Upload

      Dev-certificate-FCM.p12 
    • Prod-certificate-FCM.p12

 

Android Push Notification Setup with Firebase

 

Step 1: Add Firebase to Android App

  • In Firebase Console, add an Android app

  • Use your package name (e.g., com.xpecto.myapp)

  • Download google-services.json file

  • Add this file to the app/ folder of your Android project

 

Step 2: Update Gradle Files

In build.gradle (Project):

 

classpath 'com.google.gms:google-services:4.3.15'
 

 

In build.gradle (App):

apply plugin: 'com.google.gms.google-services'

dependencies {
    implementation 'com.google.firebase:firebase-messaging:23.1.0'
}
 

 

Step 3: Create a Firebase Messaging Service

Create a custom class to handle incoming messages:

 

public class MyFirebaseMessagingService extends FirebaseMessagingService {
    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        // Handle your push notification logic here
    }
}
 

 

Also, update your AndroidManifest.xml to register this service.

 

Test Push Notifications via Firebase

  1. Go to Firebase Console > Cloud Messaging

  2. Click Send Message

  3. Set a title and body

  4. Target a specific device or app

  5. Click Test

 

If everything is set correctly, you should receive the notification on your device

 

Need Help?

At Xpecto® IT Solutions, we help startups and enterprises integrate cloud messaging and real-time features seamlessly. Whether you're building in React Native, Swift, or Kotlin, we can support you from setup to scaling.

 

 

 

Share:
Related Blogs
Complete Beginner’s Guide to Setting Up Push Notifications in iOS & Android Using Firebase

Complete Beginner’s Guide to Setting Up Push Notifications in iOS & Android Using Firebase

Push Notifications are essential for modern apps — whether you're reminding users of a new message, sending a promotional offer, or alerting about important updates. In this blog, we’ll walk you through setting up push notifications for both iOS and Android using Firebase, in a way that even freshers can follow.

Apple Pay Integration for Digital Services: A Comprehensive Guide

Apple Pay Integration for Digital Services: A Comprehensive Guide

Apple Pay is Apple’s own digital payment system, designed to make transactions smooth, secure, and hassle-free across Apple devices. By integrating Apple Pay into your digital services, you can enhance the user experience, stay compliant with Apple’s policies, and offer customers a trusted payment method.

Custom Applications: Driving Digital Transformation for Enterprises

Custom Applications: Driving Digital Transformation for Enterprises

Custom app development is reshaping the way businesses operate in today’s digital world. Custom web apps allow companies to come up with highly unique solutions which improve the efficiency and manageability of the activities performed in the organizations. 

Our Partners