Kotlin Multiplatform push notifications: a complete guide 2026

Learn how to implement Kotlin Multiplatform push notifications for Android and iOS using Firebase Cloud Messaging and APNs.

Posted by

Kotlin Multiplatform push notifications: a complete guide 2026
TL;DR
  • Kotlin Multiplatform supports push notifications for both Android and iOS.
  • Use the expect/actual pattern for platform-specific APIs.
  • KMPShip includes pre-configured push notification support in starter tiers.
In today's mobile app landscape, push notifications are vital for user engagement and retention. Implementing push notifications in a Kotlin Multiplatform (KMP) project allows you to reach both Android and iOS users with minimal code duplication. This guide will walk you through the steps to set up push notifications using Firebase Cloud Messaging (FCM) for Android and Apple Push Notification service (APNs) for iOS, ensuring you can effectively communicate with your users regardless of their platform.

How do you handle push notifications in shared Kotlin code?

You can efficiently manage push notifications in shared Kotlin code using the expect/actual pattern. This pattern allows you to define common interfaces in your shared code while providing platform-specific implementations that adhere to these interfaces. By doing so, you can ensure that the core notification logic remains consistent across platforms, while platform-specific details are encapsulated.

Setting up Firebase Cloud Messaging for Android

To set up FCM for your Android application, follow these steps:
  1. Add FCM to your project: Include the Firebase BoM in your build.gradle:
    groovy
    implementation platform('com.google.firebase:firebase-bom:30.3.1') implementation 'com.google.firebase:firebase-messaging'
  2. Configure Firebase: Download the google-services.json file from the Firebase Console and place it in your app directory.
  3. Request permissions: Use the following code snippet to request notification permissions:
    kotlin
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val channel = NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT) notificationManager.createNotificationChannel(channel) }
  4. Handle messages: Override the onMessageReceived method in your FirebaseMessagingService to handle incoming messages.

Setting up APNs for iOS

For iOS, the setup process involves a few key steps:
  1. Enable push notifications: Go to your app's capabilities in Xcode and enable push notifications.
  2. Register for remote notifications: Add this code to your AppDelegate:
    swift
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in if granted { DispatchQueue.main.async { UIApplication.shared.registerForRemoteNotifications() } } }
  3. Handle token and messages: Implement the didRegisterForRemoteNotificationsWithDeviceToken method to handle device tokens and send them to your backend.

Push notification setup: Android (FCM) vs iOS (APNs) in KMP

FeatureAndroid (FCM)iOS (APNs)
Setup ProcessRequires Firebase ConsoleRequires Xcode capabilities
PermissionsRequest permissions at runtimeUser grants permissions
Notification ChannelsRequired for Android Oreo+Not applicable
Background HandlingAutomatically deliveredRequires AppDelegate setup
Payload FormatJSONJSON

How do you manage notification channels on Android?

Notification channels are essential for managing different types of notifications in Android. Starting with Android 8.0 (Oreo), you must create a notification channel to show notifications. This can be done as follows:
  1. Create a channel: When your app starts, create notification channels depending on your requirements.
  2. Assign notifications to channels: Specify the channel ID when building your notification.

Example of creating a notification channel

Here is a code snippet that demonstrates how to create a notification channel:
kotlin
val channel = NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH) channel.description = CHANNEL_DESCRIPTION notificationManager.createNotificationChannel(channel)

How do you handle permissions for notifications on both platforms?

Permissions handling differs significantly between Android and iOS. On Android, you must request permission at runtime, especially for devices running Android 13 and higher. In contrast, iOS users must manually grant permission for notifications, typically via a prompt that appears the first time the app requests it.

Permission request flow

  1. Android: On Android, check if the notification permission is granted and request it if not.
  2. iOS: On iOS, simply request permission during the app launch or when you need to send notifications.

How do you handle deep linking from notifications?

Deep linking allows you to navigate users to specific parts of your app directly from a notification. This can enhance user experience by reducing friction in accessing content. To implement deep linking:
  1. Define a URL scheme: Set up a URL scheme in both Android and iOS.
  2. Handle the URL: When a user taps a notification, parse the URL and navigate to the appropriate screen.

Example of deep linking handling in Android

kotlin
val intent = Intent(this, YourActivity::class.java).apply { data = Uri.parse(

Build your KMP app faster

Skip the setup and start shipping with a production-ready Kotlin Multiplatform starter kit.

Kotlin Multiplatform push notifications: a complete guide 2026