Blog
PRODUCT NEWS

How to Implement Push Notifications in Android with Courier’s SDK and Firebase

Mike Miller

April 03, 2023

android SDK header

Table of contents

Push notifications are a critical part of modern mobile apps, helping you keep users engaged, informed, and connected in real time. But implementing push across different platforms—especially on Android—can quickly become complex. Developers must manage device tokens, handle permissions, test notifications, and deal with platform-specific quirks.

Courier’s Android Mobile Notifications SDK is built to simplify that process. It provides a set of tools that make it easier to manage user state, handle token registration and lifecycle, and send test push notifications—all without the heavy setup typically required.

Before we dive into the technical setup, here’s a quick overview of the key benefits Courier’s Android SDK offers:

  • Simplified token management: Automatically handle the generation, storage, and updating of device tokens needed for sending push notifications.
  • Streamlined user state management: Keep notification delivery in sync with user authentication status, reducing errors and improving user experience.
  • Built-in testing tools: Send test push notifications easily during development to ensure everything is working before going live.

By removing the friction of manual token and state management, Courier helps Android developers get push notifications up and running faster—and more reliably.

Let’s walk through how to get started with the Courier Android SDK.

How to Set Up Push Notifications with the Courier Android SDK

To get started with the Courier Android SDK, you will need to have the following:

  1. Android Studio or any other development environment that supports Android development. The SDK supports Java, Kotlin, and Firebase Cloud Messaging.
  2. A valid Firebase project. Although the Courier SDK itself doesn’t need a Firebase account, if you want to send push notifications to your app you will need a Firebase account.
  3. A physical Android device for testing. Testing push notifications with or without the Courier SDK does not work well with emulators.
  4. A Courier account. You need an account in order to use the SDK.
  5. The SDK. Once you have the other prerequisites, you can download the SDK and include it in your project.

To install the Courier Android SDK have a look at the step-by-step guide on our GitHub page.

Once you’ve successfully set up the Courier SDK in your Android app, let's dive into some of the features of the SDK.

A note to the developers amongst you: Some of the functions that we will cover below depend on an AppCompatActivity, just something to keep in mind as we move forward.

Managing User State for Push Notifications

Before sending push notifications, it’s critical to manage user state properly—meaning whether a user is signed in, signed out, or otherwise active within your app.

User state directly impacts the notification experience. For example, if a user signs out, they shouldn’t continue receiving personalized push messages intended for active sessions. Failing to sync user state with notification delivery can lead to confusion, privacy issues, and a degraded app experience.

Courier’s Android SDK helps you keep user state and push tokens automatically in sync, minimizing manual overhead.

To manage user state with Courier:

Use the Courier.shared.signIn() method when a user signs into your app. This ensures the user’s device tokens are correctly registered and associated with their session.

Copied!

Courier.shared.signIn(
accessToken = authKey_or_accessToken,
userId = userId
)

The accessToken can either be a Courier Auth Key used during development or a JWT (JSON Web Token) that should be used in your production app.

When the user signs out, you can use the Courier.shared.signOut() function to clear their state.

Copied!

Courier.shared.signOut()

By following these steps, the FCM (Firebase Cloud Messaging) tokens on Android will be automatically synced to Courier, making it easier for you to manage the user's state and send relevant and timely push notifications.

Handling Push Notification Permissions

A smooth notification experience starts with asking users for permission at the right moment in their journey. However, managing permission requests manually can be tricky—especially across different Android versions.

Courier simplifies this process with the requestNotificationPermission() function, allowing you to easily check and request notification permissions in your app:

Copied!

if (requestNotificationPermission()) {
//Send some notification
}

The requestNotificationPermission() function returns a Boolean:

  • true if the user has granted notification permissions
  • false if permissions are denied

This makes it easy to conditionally trigger next steps, such as sending a test notification once permission is confirmed.

On newer versions of Android (version 33 and above), calling this function automatically prompts users with a system permission request for push notifications.
On older Android versions, the function will always return true by default, since explicit permission isn’t required.

By using Courier’s permission tools, you can ensure a smoother, more consistent push notification experience across all Android devices.

Tracking Push Notification Delivery Status

Courier’s Android SDK includes the onPushNotificationDelivered() function, which is triggered whenever a push notification is successfully delivered to a user’s device.

This makes it easy to:

  • Track delivery status in real time
  • Monitor notification reliability
  • Build better analytics around your push campaigns

Copied!

override fun onPushNotificationDelivered(message: RemoteMessage) {
print(message)
}

Important:
The onPushNotificationDelivered() function is only triggered when the app is in the foreground or background state.
It will not be called if the app is completely closed ("killed" or "not running" state).

To use this callback, the activity must extend CourierActivity, which is a subclass of AppCompatActivity.

Tracking When a User Clicks a Push Notification

While tracking delivery is important, it's just as critical to know when users actually interact with your notifications.

Courier’s Android SDK makes this easy with the onPushNotificationClicked() function.
This callback is triggered whenever a user taps on a push notification, allowing you to define exactly what should happen next—whether it’s opening a specific screen, starting an action, or recording engagement.

Copied!

override fun onPushNotificationClicked(message: RemoteMessage) {
print(message)
}

In the example above, the function simply prints the notification payload.

In a real app, you would replace this with your own logic—such as opening a specific activity, deep-linking to a screen, or displaying a custom UI component based on the notification content.

Sending a Test Push Notification

Now that you’ve handled permissions and know how to track delivery and user interactions, let’s walk through how to send a test push notification.

Courier makes this process simple:
You can send a push notification directly to a user’s ID using the SDK—without needing to manually call Firebase from your backend or handle raw HTTP requests.

The userId you send to should match the IDs you use in your existing authentication system.
This ensures consistency and simplifies managing user state and tokens across your app.

To send a test push, use the sendPush() function:

Copied!

val messageId = Courier.shared.sendPush(
authKey: 'a_courier_auth_key_only_for_testing',
userId: 'example_user',
title: 'Hello!',
body: 'This is a push message from Courier 🐣',
providers: [CourierProvider.fcm],
)

Caution:
The sendPush() function will send a push notification to every valid device token associated with the specified userId and provider (e.g., FCM).

Be sure to use this feature only for testing purposes.

Also, remember: the authKey shown in the example is intended for development and testing only—it should never be used in production environments.

Managing Push Notification Tokens

One of the most challenging parts of implementing push notifications is managing device tokens—the unique identifiers assigned to each device that can receive notifications.

These tokens are typically generated and managed by platform-specific services like:

To reliably send push notifications, you must:

  • Capture each device's token
  • Store tokens securely on your backend
  • Associate tokens with the correct user accounts
  • Regularly update or refresh tokens (as they can change or expire)
  • Handle token deletion when a user unsubscribes or uninstalls the app

Building this infrastructure manually often requires extensive collaboration between frontend (mobile) and backend developers. This back-and-forth—designing workflows, handling edge cases, managing token lifecycles—can easily stretch across days or even weeks of development time.

Courier simplifies token management automatically.
With Courier’s mobile SDKs, you don’t need to build token handling from scratch.
Courier:

  • Automatically captures push notification tokens
  • Securely stores them
  • Keeps tokens updated and valid
  • Automatically invalidates expired or unregistered tokens

This means you can focus on building your product—not spending extra cycles architecting and maintaining a complex token management system.

Simplify Push Notifications with Courier’s Android SDK

Implementing push notifications doesn’t have to be complicated.
In this guide, you’ve seen how Courier’s Android SDK streamlines the entire process—handling token generation, secure storage, and automatic token removal—so you can focus on building great app experiences instead of managing infrastructure.

With just a few lines of code, you can integrate reliable push notifications into your Android app—no need to reinvent token management or notification delivery tracking.

Courier also offers SDKs for other platforms, including:

Whether you're building a native Android app, a cross-platform experience, or scaling across devices, Courier’s SDKs can simplify your push notification strategy—making setup faster, testing easier, and delivery more reliable.

If you're ready to streamline your mobile notifications, get started with Courier today.

Similar resources

Tabs for inbox
Product News

Help Users Navigate In-App Notifications Faster with Tabs in Courier Inbox

As your product grows, notifications pile up fast—and a single “everything” list turns into noise. Tabs for Courier Inbox let you organize in-app notifications into focused views (like Comments, Mentions, or Reactions) so users can find what they need faster, without you building custom filtering UI.

By Mike Miller

January 08, 2026

AI AGENTS FOR NOTIFICATIONS
GuideProduct NewsNotifications Landscape

Your Notifications Now Have Two Audiences: Humans and AI Agents

AI agents are now filtering, summarizing, and acting on notifications before users ever see them. In late 2024, Anthropic released the Model Context Protocol. By mid-2025, MCP had become the connective tissue for AI agents that take actions on behalf of users. Google followed with A2A. Agentic browsers like Perplexity Comet and Opera Neon started treating the web as something to navigate programmatically. Your notification strategy needs to account for machine interpretation, not just human attention.

By Kyle Seyler

January 05, 2026

whatsapp typing indicator
GuideProduct NewsEngineering

How to Use WhatsApp Typing Indicators on Twilio (Public Beta Guide)

Twilio now supports typing indicators for WhatsApp. When your backend takes a few seconds to generate a response, you can show users that something's happening instead of leaving them staring at a silent chat. The indicator appears when you call the new /v2/Indicators/Typing endpoint, automatically marks the message as read, and disappears after your response arrives or 25 seconds pass. This guide covers the API details, implementation patterns for Node.js and Python, when to use typing indicators, and current beta limitations.

By Kyle Seyler

December 03, 2025

Multichannel Notifications Platform for SaaS

Products

Platform

Integrations

Customers

Blog

API Status

Subprocessors


© 2026 Courier. All rights reserved.