### Web App Setup with KMPNotifier Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/04-configuration.md Initialize KMPNotifier for web applications, enabling the option to ask for notification permission on start and specifying the notification icon path. ```kotlin fun main() { KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Web( askNotificationPermissionOnStart = true, notificationIconPath = "/images/app-icon-192.png" ), LocalNotifications ) // Render your React/Vue/etc. app render("root") { App() } } ``` -------------------------------- ### Complete iOS App Delegate Setup for KMPNotifier and Firebase Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/08-ios-specific.md This example demonstrates the complete setup for an iOS application's AppDelegate. It includes initializing Firebase, configuring KMPNotifier with iOS-specific settings and Firebase push extensions, and handling APNS token registration and remote notification delivery. ```swift import SwiftUI import FirebaseCore import FirebaseMessaging import shared // Your KMP shared module class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { // Initialize Firebase (required for push) FirebaseApp.configure() // Initialize KMPNotifier with local + Firebase push KMPNotifier.shared.initialize( configuration: NotificationPlatformConfigurationIos( showPushNotification: true, askNotificationPermissionOnStart: true, notificationSoundName: nil // or "notification_chime" for custom sound ), extensions: [FirebasePush.shared] ) // Register for remote notifications (prompts for APNS) application.registerForRemoteNotifications() return true } // APNS token delegation to Firebase func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { // Mandatory: pass APNS token to Firebase for push delivery Messaging.messaging().apnsToken = deviceToken } // Handle remote notification in background func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult { // Deliver payload to KMPNotifier listeners KMPNotifier.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo) return .newData } // Handle remote notification in foreground (optional, for additional UI handling) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions { // If your custom UI needs the notification, you can extract it here // KMPNotifier handles the display via showPushNotification config return [.banner, .sound, .badge] } // Handle notification user interaction (click or action) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async { // KMPNotifier handles this automatically via UNUserNotificationCenter delegate // Your KMPNotifier.Listener callbacks are invoked } } @main struct iOSApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate var body: some Scene { WindowGroup { ContentView() } } } ``` -------------------------------- ### FirebasePush Extension Installation Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/03-push-notifications.md Demonstrates how to install the FirebasePush extension during KMPNotifier initialization. ```APIDOC ## FirebasePush Extension Installation ### Description Installs the Firebase push notification capability into KMPNotifier. ### Usage ```kotlin KMPNotifier.initialize(configuration, FirebasePush) ``` ### Notes - Automatically installs `LocalNotifications` as a dependency. - Delivers real push notifications on Android and iOS. - On desktop and web, installs a no-op mock for API consistency. ``` -------------------------------- ### Platform-Specific Setup Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/00-index.md Platform-specific setup for Android and iOS to handle incoming notifications. ```APIDOC ## Platform-Specific Setup ### Description Platform-specific methods required for integrating KMPNotifier, particularly for handling incoming intents on Android and remote notifications on iOS. ### Usage **Android Intent Handling:** ```kotlin KMPNotifier.onCreateOrOnNewIntent(intent) ``` **iOS Remote Notification:** ```swift KMPNotifier.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo) ``` ``` -------------------------------- ### Extension Installation Order Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/10-module-architecture.md Demonstrates the dependency-driven installation order of KMPNotifier extensions. FirebasePush automatically installs LocalNotifications if not explicitly provided. ```kotlin KMPNotifier.initialize(config, FirebasePush) ↓ FirebasePush.dependsOn = [LocalNotifications] ↓ LocalNotifications.install() ← runs first, registers local notifier ↓ FirebasePush.install() ← runs second, registers push notifier ``` ```kotlin // These produce identical results (FirebasePush installs LocalNotifications automatically): KMPNotifier.initialize(config, FirebasePush) KMPNotifier.initialize(config, LocalNotifications, FirebasePush) ``` -------------------------------- ### Web Notification Configuration Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Configure web notification settings, including whether to ask for permission on start and the path to the notification icon. ```kotlin NotificationPlatformConfiguration.Web( askNotificationPermissionOnStart: true, notificationIconPath = "/images/icon.png" ) ``` -------------------------------- ### Web Notification Setup Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/README.md Initialize KMPNotifier for web applications (JavaScript and WebAssembly). This configuration enables asking for notification permission on startup. ```kotlin fun main() { KMPNotifier.initialize( NotificationPlatformConfiguration.Web( askNotificationPermissionOnStart = true, notificationIconPath = null ), LocalNotifications, ) } ``` -------------------------------- ### Run Sample App Commands for KMPNotifier Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/CLAUDE.md Commands to install and run the KMPNotifier sample applications on Android, Desktop, and Web (Wasm). ```sh ./gradlew :androidApp:installDebug ``` ```sh ./gradlew :desktopApp:run ``` ```sh ./gradlew :webApp:wasmJsBrowserDevelopmentRun ``` -------------------------------- ### Desktop Notification Setup Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/README.md Initialize KMPNotifier for desktop applications. Requires a notification icon in the 'resources/common' folder. Ensure the icon path is correctly specified. ```kotlin fun main() = application { KMPNotifier.initialize( NotificationPlatformConfiguration.Desktop( showPushNotification = true, notificationIconPath = composeDesktopResourcesPath() + File.separator + "ic_notification.png" ), LocalNotifications, ) Window( onCloseRequest = ::exitApplication, title = "KMPNotifier Desktop", ) { println("Desktop app is started") App() } } ``` -------------------------------- ### Android MainActivity Setup (Kotlin) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Handle notification creation and permission requests in your Android MainActivity. Ensure KMPNotifier is initialized with the intent and the notification permission is requested. ```kotlin import androidx.activity.ComponentActivity import android.os.Bundle import android.content.Intent import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.permission.permissionUtil class MainActivity : ComponentActivity() { private val permissionUtil by permissionUtil() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) KMPNotifier.onCreateOrOnNewIntent(intent) permissionUtil.askNotificationPermission() setContent { App() } } override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) KMPNotifier.onCreateOrOnNewIntent(intent) } ``` -------------------------------- ### Initialize KMPNotifier with varargs extensions Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/01-kmpnotifier-facade.md Initializes the KMPNotifier library once at application start with platform-specific configuration and a variable number of notification extensions. ```APIDOC ## initialize(configuration: NotificationPlatformConfiguration, vararg extensions: KMPNotifierExtension): Unit ### Description Initializes the library once at application start. ### Parameters #### Path Parameters - `configuration` (NotificationPlatformConfiguration) - Required - Platform-specific config: `Android`, `Ios`, `Desktop`, or `Web` - `extensions` (KMPNotifierExtension) - Required - Capabilities to install; e.g., `LocalNotifications`, `FirebasePush` ### Return Unit ### Throws - `IllegalStateException` if extensions declare invalid dependencies ### Notes - On iOS, call from the **main thread** (e.g., `didFinishLaunchingWithOptions`). The notification delegate is installed during init. - Calling again is a no-op for the configuration; new extensions not yet installed are still installed. - The varargs overload is hidden from Swift/ObjC; use the `List` overload from those languages. ### Request Example (Kotlin) ```kotlin // Local notifications only: KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification ), LocalNotifications ) // Local + Firebase push: KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification ), FirebasePush // installs LocalNotifications automatically ) ``` ### Request Example (Swift) ```swift KMPNotifier.shared.initialize( configuration: NotificationPlatformConfigurationIos( showPushNotification: true, askNotificationPermissionOnStart: true, notificationSoundName: nil ), extensions: [FirebasePush.shared] ) ``` ``` -------------------------------- ### LocalNotifications Extension Implementation Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Example implementation of a KMPNotifierExtension for local notifications. It registers the local notifier with the runtime during the installation process. ```kotlin public object LocalNotifications : KMPNotifierExtension { override fun install(runtime: NotifierRuntime) { // Register the local notifier with the runtime val notifier = createPlatformNotifier(runtime) NotifierInternals.registerLocalNotifier(notifier) } } ``` -------------------------------- ### Android Application Setup (Kotlin) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Configure your Android application by applying necessary plugins, setting the minimum SDK, and initializing KMPNotifier within your Application class. Ensure the notification icon resource is provided. ```kotlin plugins { id("com.android.application") id("com.google.gms.google-services") // Required for push } android { defaultConfig { minSdk = 23 // Required minimum } } import android.app.Application import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.notification.configuration.NotificationPlatformConfiguration import com.mmk.kmpnotifier.push.firebase.FirebasePush class MyApplication : Application() { override fun onCreate() { super.onCreate( KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_launcher_foreground ), FirebasePush // includes local ) } } ``` -------------------------------- ### NotifierManager.initialize Replacement Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md Examples of how to initialize the new KMPNotifier with either local notifications only or with both local and Firebase push notifications. ```kotlin // For local notifications only: KMPNotifier.initialize(configuration, LocalNotifications) // For local + Firebase push (android/ios): KMPNotifier.initialize(configuration, FirebasePush) ``` -------------------------------- ### Simple NotificationAction Example Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Defines a basic action button for a notification with an ID and title. Supported on Android and iOS. ```kotlin NotificationAction(id = "OPEN", title = "Open app") ``` -------------------------------- ### Initialize iOS with Auto Permission Request Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/05-permissions.md Configure KMPNotifier to automatically ask for notification permission when the iOS app starts. ```kotlin KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Ios( askNotificationPermissionOnStart = true // Request permission on app launch ), FirebasePush ) ``` -------------------------------- ### Handling Notification Actions in Listener Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Example of how to implement the `onAction` callback in `KMPNotifier.Listener` to handle user interactions with notification actions, including text input. ```kotlin KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onAction(actionId: String, notificationId: Int, payload: PayloadData) { when (actionId) { "REPLY" -> { val userReply = payload["remote_input"] as? String println("User replied: $userReply") } "OPEN" -> { val url = payload[Notifier.KEY_URL] as? String navigateTo(url) } } } }) ``` -------------------------------- ### Initialize KMPNotifier with a List of extensions Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/01-kmpnotifier-facade.md Initializes the KMPNotifier library once at application start with platform-specific configuration and a list of notification extensions. This overload is preferred for Swift/Objective-C usage. ```APIDOC ## initialize(configuration: NotificationPlatformConfiguration, extensions: List): Unit ### Description List-based overload of initialize. Use from Swift/ObjC where NSArray bridges naturally. ### Parameters #### Path Parameters - `configuration` (NotificationPlatformConfiguration) - Required - Platform-specific config - `extensions` (List) - Required - List of capabilities to install ### Return Unit ``` -------------------------------- ### Desktop App Setup with KMPNotifier Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/04-configuration.md Configure KMPNotifier for desktop applications, specifying the notification icon path and enabling push notifications. Includes a helper function to locate resources. ```kotlin import androidx.compose.ui.window.application import androidx.compose.ui.window.Window import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.notification.configuration.NotificationPlatformConfiguration import com.mmk.kmpnotifier.local.LocalNotifications import java.io.File fun main() = application { KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Desktop( showPushNotification = true, notificationIconPath = composeDesktopResourcesPath() + File.separator + "ic_notification.png" ), LocalNotifications ) Window( onCloseRequest = ::exitApplication, title = "Desktop App", ) { App() } } // Helper function to get the resources path private fun composeDesktopResourcesPath(): String { return System.getProperty("java.class.path") .split(File.pathSeparator) .firstOrNull { it.contains("resources") } ?.removeSuffix("/resources") ?: "." } ``` -------------------------------- ### NotificationImage.File Example Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Represents an image from a local file path. Requires read permission for the file. Rendered similarly to URL images on Android and iOS. ```kotlin image = NotificationImage.File("/data/user/0/com.example.app/cache/image.png") ``` -------------------------------- ### iOS AppDelegate Setup (Swift) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Configure Firebase and KMPNotifier in your iOS AppDelegate. This includes initializing Firebase, setting up KMPNotifier with iOS configuration, and registering for remote notifications. ```swift import SwiftUI import FirebaseCore import FirebaseMessaging import shared class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { FirebaseApp.configure() KMPNotifier.shared.initialize( configuration: NotificationPlatformConfigurationIos( askNotificationPermissionOnStart: true ), extensions: [FirebasePush.shared] ) application.registerForRemoteNotifications() return true } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Messaging.messaging().apnsToken = deviceToken } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult { KMPNotifier.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo) return .newData } } @main struct iOSApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate var body: some Scene { WindowGroup { ContentView() } } } ``` -------------------------------- ### Set KMPNotifier Logger Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/README.md Configure a logger to view internal library logs. This example sets the logger to print messages to the console. ```kotlin KMPNotifier.setLogger { message -> println(message) } ``` -------------------------------- ### Initialize KMPNotifier with FirebasePush Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/03-push-notifications.md Install the Firebase push notification capability by passing FirebasePush to KMPNotifier.initialize. This automatically includes LocalNotifications. ```kotlin KMPNotifier.initialize(configuration, FirebasePush) ``` -------------------------------- ### iOS App Setup with KMPNotifier Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/04-configuration.md Initialize KMPNotifier for iOS applications, setting up Firebase, push notification permissions, and notification sound. Handles remote notification reception. ```swift import SwiftUI import FirebaseCore import FirebaseMessaging import shared class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { FirebaseApp.configure() KMPNotifier.shared.initialize( configuration: NotificationPlatformConfigurationIos( showPushNotification: true, askNotificationPermissionOnStart: true, notificationSoundName: "notification_chime" ), extensions: [FirebasePush.shared] ) return true } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Messaging.messaging().apnsToken = deviceToken } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult { KMPNotifier.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo) return .newData } } @main struct iOSApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate var body: some Scene { WindowGroup { ContentView() } } } ``` -------------------------------- ### Get Notifiers (1.x vs 2.x) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md Illustrates how to obtain local and push notifiers in KMPNotifier 1.x versus 2.x, highlighting the change from method calls to property access. ```kotlin val localNotifier = NotifierManager.getLocalNotifier() val pushNotifier = NotifierManager.getPushNotifier() ``` ```kotlin val localNotifier = KMPNotifier.localNotifier val pushNotifier = KMPNotifier.firebasePushNotifier ``` -------------------------------- ### NotificationAction with Text Input Example Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Defines an action button that allows inline text input from the user. The input label is used as a placeholder. Supported on Android and iOS. ```kotlin NotificationAction( id = "REPLY", title = "Reply", allowsTextInput = true, inputLabel = "Type a message…" ) ``` -------------------------------- ### Run KMPNotifier Gradle Commands Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/CLAUDE.md Execute various Gradle tasks for KMPNotifier, including API checks, regeneration, testing, and documentation. Ensure JDK 17+ is installed. ```sh ./gradlew apiCheck ``` ```sh ./gradlew apiDump ``` ```sh ./gradlew testAndroidHostTest ``` ```sh ./gradlew jvmTest jsNodeTest ``` ```sh ./gradlew iosX64Test iosSimulatorArm64Test ``` ```sh ./gradlew :kmpnotifier-core:jvmTest --tests "com.mmk.kmpnotifier.SomeTest" ``` ```sh ./gradlew :dokkaGenerate ``` ```sh ./gradlew publishToMavenLocal ``` ```sh ./gradlew kotlinUpgradeYarnLock ``` -------------------------------- ### iOS Notification Configuration Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Configure iOS notification settings, including whether to show push notifications, ask for permission on start, and the notification sound name. ```swift NotificationPlatformConfigurationIos( showPushNotification: true, askNotificationPermissionOnStart: true, notificationSoundName: "notification_chime" ) ``` -------------------------------- ### Schedule a Local Notification Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Schedule a local notification to appear at a specific future time. This example schedules a notification for one hour from the current time using `Clock.System.now()`. ```kotlin import kotlinx.datetime.Clock KMPNotifier.localNotifier.notify { title = "Reminder" scheduledAt = Clock.System.now().toEpochMilliseconds() + 3600_000 // 1 hour from now } ``` -------------------------------- ### Listen for Notification Clicks (Kotlin) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Add a listener to KMPNotifier to handle notification click events. This example logs a message when a notification is clicked. ```kotlin import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.notification.Notifier fun listenForClicks() { KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onNotificationClicked(data: PayloadData) { println("Notification clicked!") } }) } ``` -------------------------------- ### Ask Notification Permission and Handle Result Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/05-permissions.md Explicitly ask for notification permission and handle the granted status. If permission is denied, display a message guiding the user to settings. ```kotlin KMPNotifier.permissionUtil.askNotificationPermission { granted -> updateUI(permissionGranted = granted) if (!granted) { showSnackbar("Enable notifications in Settings to receive updates") } } ``` -------------------------------- ### Initialize KMPNotifier on iOS using Swift Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/01-kmpnotifier-facade.md Initialize KMPNotifier on iOS using Swift, configuring push notification display and permission prompts. This example includes FirebasePush as an extension. ```swift KMPNotifier.shared.initialize( configuration: NotificationPlatformConfigurationIos( showPushNotification: true, askNotificationPermissionOnStart: true, notificationSoundName: nil ), extensions: [FirebasePush.shared] ) ``` -------------------------------- ### NotificationImage.Url Example Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Represents an image fetched from a remote URL. Requires internet permission and the URL must be reachable. Rendered as a large image on Android and an attachment on iOS. ```kotlin image = NotificationImage.Url("https://example.com/product.png") ``` -------------------------------- ### Initialize KMPNotifier with LocalNotifications Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/02-local-notifications.md Install the LocalNotifications extension during KMPNotifier initialization. If FirebasePush is used, LocalNotifications is included automatically. On iOS, always pass LocalNotifications or FirebasePush to initialize to avoid issues with cold-start notification clicks. ```kotlin KMPNotifier.initialize(configuration, LocalNotifications) // or with push: KMPNotifier.initialize(configuration, FirebasePush) // includes LocalNotifications ``` -------------------------------- ### Complete KMPNotifier Android Integration Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/07-android-specific.md Initialize KMPNotifier in your Application class, configure platform-specific settings, and set up listeners for push and click events. This example demonstrates integration with Firebase Push. ```kotlin // Application.kt import android.app.Application import androidx.startup.AppInitializer import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.notification.configuration.NotificationPlatformConfiguration import com.mmk.kmpnotifier.push.firebase.FirebasePush class MyApplication : Application() { override fun onCreate() { super.onCreate() // Initialize KMPNotifier with Firebase push // Context is captured by androidx.startup (if enabled) KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification, notificationIconColorResId = R.color.primary, notificationChannelData = NotificationPlatformConfiguration.Android.NotificationChannelData( id = "ORDERS", name = "Order notifications", description = "Notifications about your orders", soundUri = null // or "android.resource://${packageName}/raw/order_sound" ), showPushNotification = true ), FirebasePush // Includes LocalNotifications automatically ) // Set up logging KMPNotifier.setLogger { message -> Log.d("KMPNotifier", message) } // Listen for push events FirebasePush.addListener(object : PushListener { override fun onNewToken(token: String) { viewModel.updateUserToken(token) } override fun onPushNotificationWithPayloadData(title: String?, body: String?, data: PayloadData) { val orderId = data["orderId"] as? String if (orderId != null) { viewModel.updateOrder(orderId) } } }) // Listen for click events KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onNotificationClicked(data: PayloadData) { val orderId = data["orderId"] as? String if (orderId != null) { navigateToOrder(orderId) } } }) } } // MainActivity.kt import androidx.activity.ComponentActivity import android.os.Bundle import android.content.Intent import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.permission.permissionUtil class MainActivity : ComponentActivity() { private val permissionUtil by permissionUtil() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Deliver notification intent from cold start KMPNotifier.onCreateOrOnNewIntent(intent) // Request POST_NOTIFICATIONS permission (Android 13+) permissionUtil.askNotificationPermission { granted -> if (granted) { println("Notifications enabled") } } setContent { App() } } override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) // Deliver notification intent when app is already running KMPNotifier.onCreateOrOnNewIntent(intent) } } ``` -------------------------------- ### Replacement Listeners for Shared and Push Events Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md Code examples demonstrating the use of KMPNotifier.Listener for shared events (notification clicks and actions) and PushListener for push-specific events. The permission utility is now accessed separately. ```kotlin // Shared events (notification clicks and actions): KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onNotificationClicked(data: PayloadData) { // former NotifierManager.Listener.onNotificationClicked } override fun onAction(actionId: String, notificationId: Int, payload: PayloadData) { // former NotifierManager.Listener.onAction } }) // Push-specific events: KMPNotifier.addPushListener(object : PushListener { override fun onNewToken(token: String) { // former NotifierManager.Listener.onNewToken } override fun onPayloadData(data: PayloadData) { // former NotifierManager.Listener.onPayloadData } override fun onPushNotification(title: String?, body: String?) { // former NotifierManager.Listener.onPushNotification } override fun onPushNotificationWithPayloadData(title: String?, body: String?, data: PayloadData) { // former NotifierManager.Listener.onPushNotificationWithPayloadData } }) // Permission util is now accessed separately: val permissionUtil = KMPNotifier.permissionUtil ``` -------------------------------- ### Android App Setup with KMPNotifier Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/04-configuration.md Configure KMPNotifier for Android applications, including notification icon, color, channel data, and push notification settings. Requires POST_NOTIFICATIONS permission for Android 13+. ```kotlin import android.app.Application import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.notification.configuration.NotificationPlatformConfiguration import com.mmk.kmpnotifier.push.firebase.FirebasePush class MyApplication : Application() { override fun onCreate() { super.onCreate() KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification, notificationIconColorResId = R.color.primary, notificationChannelData = NotificationPlatformConfiguration.Android.NotificationChannelData( id = "ORDERS", name = "Order notifications", description = "Notifications about your orders", soundUri = "android.resource://${packageName}/raw/order_chime" ), showPushNotification = true ), FirebasePush // includes local notifications ) // Request POST_NOTIFICATIONS permission in an Activity // (required for Android 13+) } } ``` -------------------------------- ### Set Custom Logger Implementation Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Configure KMPNotifier to use a custom logger by providing an implementation of the Logger interface. This example shows how to log to Android's Logcat or standard output. ```kotlin KMPNotifier.setLogger { message -> Log.d("KMPNotifier", message) // Android // or println("KMPNotifier: $message") } ``` -------------------------------- ### onCreateOrOnNewIntent Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/07-android-specific.md Delivers notification payload data from an Intent when the launcher Activity is created or receives a new intent. This method should be called in the launcher Activity's `onCreate` and `onNewIntent` to handle notification clicks from both cold and warm starts. ```APIDOC ## `fun KMPNotifier.onCreateOrOnNewIntent(intent: Intent?): Unit` ### Description Delivers notification payload data from an Intent when the launcher Activity is created or receives a new intent. ### Method `KMPNotifier.onCreateOrOnNewIntent` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin import android.content.Intent import android.os.Bundle import androidx.activity.ComponentActivity import com.mmk.kmpnotifier.KMPNotifier class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Deliver notification click from cold start KMPNotifier.onCreateOrOnNewIntent(intent) setContent { App() } } override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) // Deliver notification click when activity is already running KMPNotifier.onCreateOrOnNewIntent(intent) } } ``` ### Response #### Success Response (Unit) This method does not return a value. #### Response Example N/A ``` -------------------------------- ### FirebasePush Extension Implementation with Dependencies Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Example implementation of a KMPNotifierExtension for Firebase push notifications. It declares a dependency on LocalNotifications, ensuring it's installed first, and registers the push notifier. ```kotlin public object FirebasePush : KMPNotifierExtension { override val dependsOn: List get() = listOf(LocalNotifications) override fun install(runtime: NotifierRuntime) { // Register the push notifier NotifierInternals.registerPushNotifier(createFirebasePushNotifier()) } } ``` -------------------------------- ### Initialize KMPNotifier (1.x vs 2.x) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md Shows the difference in initializing the NotifierManager in version 1.x compared to KMPNotifier in version 2.x, including the addition of platform-specific notifiers. ```kotlin NotifierManager.initialize( NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification ) ) ``` ```kotlin KMPNotifier.initialize( NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification ), FirebasePush // or LocalNotifications for local-only ) ``` -------------------------------- ### Get Firebase Push Token Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/03-push-notifications.md Retrieves the current Firebase push notification token. ```APIDOC ## Get Firebase Push Token ### Description Retrieves the Firebase push notification token managed by the `FirebasePush` extension. ### Method `getToken()` ### Endpoint N/A (SDK method) ### Parameters None ### Throws `IllegalStateException` if not initialized or if `FirebasePush` was not passed to `initialize` ### Example ```kotlin val token = KMPNotifier.firebasePushNotifier.getToken() ``` ``` -------------------------------- ### NotifierManager.getPushNotifier Replacement Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md Examples of accessing the push notifier using the new KMPNotifier or FirebasePush APIs. ```kotlin val pushNotifier = KMPNotifier.firebasePushNotifier // or val pushNotifier = FirebasePush.notifier ``` -------------------------------- ### Deprecated NotifierManager.getPushNotifier Signature Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md The old signature for getting the push notifier. Use KMPNotifier.firebasePushNotifier or FirebasePush.notifier instead. ```kotlin @Deprecated(message = "Use KMPNotifier.firebasePushNotifier") fun getPushNotifier(): PushNotifier ``` -------------------------------- ### LocalNotifications Extension Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/02-local-notifications.md The `LocalNotifications` extension installs and manages the local notification capability. It provides access to the `notifier` instance. ```APIDOC ## LocalNotifications Extension ### `object LocalNotifications : KMPNotifierExtension` The extension that installs and manages local notification capability. **Installation:** ```kotlin KMPNotifier.initialize(configuration, LocalNotifications) // or with push: KMPNotifier.initialize(configuration, FirebasePush) // includes LocalNotifications ``` **Property:** #### `notifier: Notifier` The local notifier instance for the current platform. **Type:** `Notifier` (read-only) **Throws:** `IllegalStateException` if `KMPNotifier.initialize` has not been called **Notes:** - If `LocalNotifications` was not passed to `initialize`, it is installed lazily on first access (with a warning logged). - On iOS, lazy installation can miss cold-start notification clicks. Always pass `LocalNotifications` (or `FirebasePush`) to `initialize`. **Example:** ```kotlin val notifier = LocalNotifications.notifier // or KMPNotifier.localNotifier ``` ``` -------------------------------- ### KMPNotifierExtension Interface Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/06-types.md Defines the structure for extensions that can be plugged into KMPNotifier. It includes a property for specifying dependencies and a method for installation. ```APIDOC ## interface KMPNotifierExtension ### Description Base interface for pluggable library capabilities. ### Methods & Properties: #### `val dependsOn: List` Extensions that must be installed before this one. **Type:** `List` (read-only) **Default:** `emptyList()` #### `fun install(runtime: NotifierRuntime): Unit` Called once during `KMPNotifier.initialize` (or on the first `initialize` call that includes this extension). ### Parameters: #### `runtime` - **Type:** `NotifierRuntime` - **Required:** Yes - **Description:** Runtime context for registration ### Returns: Unit ``` -------------------------------- ### Initialization Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/MIGRATION.md Explains how to initialize KMPNotifier with different notification capabilities (extensions) in version 2.0, contrasting it with the older 1.x method. ```APIDOC ## Initialization ### Description This section details the initialization process for KMPNotifier in version 2.0, highlighting the use of extensions to specify notification capabilities. It contrasts the new approach with the deprecated method from version 1.x. ### Method `KMPNotifier.initialize()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **configuration** (Configuration) - Required - The main configuration object for the notifier. - **extensions** (*NotificationExtension) - Optional - One or more extensions to enable specific notification functionalities (e.g., `LocalNotifications`, `FirebasePush`). - **context** (Context) - Optional (Android overload) - The Android context, required when `androidx-startup` is disabled. ### Request Example ```kotlin // Local notifications only: KMPNotifier.initialize(configuration, LocalNotifications) // Local + Firebase push: KMPNotifier.initialize(configuration, FirebasePush) // Android overload: KMPNotifier.initialize(context, configuration, FirebasePush) ``` ### Response No explicit response is documented for initialization. The method configures the notifier instance. ``` -------------------------------- ### Configure Desktop Notifications Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/04-configuration.md Use this to initialize KMPNotifier with desktop-specific settings. The `showPushNotification` parameter is a no-op on desktop. Ensure the `notificationIconPath` points to a valid PNG file. ```kotlin KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Desktop( notificationIconPath = composeDesktopResourcesPath() + File.separator + "ic_notification.png" ), LocalNotifications ) ``` -------------------------------- ### Initialize Web with Auto Permission Request Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/05-permissions.md Configure KMPNotifier to automatically ask for notification permission when the Web app loads. ```kotlin KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Web( askNotificationPermissionOnStart = true // Request permission on page load ), LocalNotifications ) ``` -------------------------------- ### Get Firebase Push Token (Kotlin) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Retrieve the Firebase push token. This operation must be called from a coroutine context. ```kotlin import com.mmk.kmpnotifier.KMPNotifier import kotlinx.coroutines.launch // Must call from a coroutine viewModelScope.launch { val token = KMPNotifier.firebasePushNotifier.getToken() println("Token: $token") } ``` -------------------------------- ### Deprecated NotifierManager.getLocalNotifier Signature Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md The old signature for getting the local notifier. Access the local notifier via KMPNotifier.localNotifier or LocalNotifications.notifier. ```kotlin @Deprecated(message = "Use KMPNotifier.localNotifier") fun getLocalNotifier(): Notifier ``` -------------------------------- ### Initialize KMPNotifier with Manual Context (Android) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/07-android-specific.md Use this overload when androidx.startup is disabled and you need to pass the application context manually. Typically called in `Application.onCreate()`. ```kotlin import android.app.Application import com.mmk.kmpnotifier.KMPNotifier import com.mmk.kmpnotifier.notification.configuration.NotificationPlatformConfiguration import com.mmk.kmpnotifier.push.firebase.FirebasePush class MyApplication : Application() { override fun onCreate() { super.onCreate() // If androidx.startup is disabled, pass context manually: KMPNotifier.initialize( context = this, // application context configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification ), FirebasePush ) } } ``` -------------------------------- ### Configure Web Notifications Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/04-configuration.md Initialize KMPNotifier for web platforms. Set `askNotificationPermissionOnStart` to control automatic permission requests. The `notificationIconPath` can be a URL or bundled asset. ```kotlin KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Web( askNotificationPermissionOnStart = true, notificationIconPath = "/images/notification-icon.png" ), LocalNotifications ) ``` -------------------------------- ### Initialization Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/00-index.md Initialize the KMPNotifier library with a configuration and a notification provider (Local or Firebase Push). ```APIDOC ## Initialization ### Description Initialize the KMPNotifier library with a configuration and a notification provider. ### Usage ```kotlin // Local only KMPNotifier.initialize(configuration, LocalNotifications) // Local + Firebase push KMPNotifier.initialize(configuration, FirebasePush) ``` ``` -------------------------------- ### Initialize KMPNotifier with Automatic Context Capture (Android) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/07-android-specific.md This overload is used when androidx.startup is enabled, allowing KMPNotifier to automatically capture the application context. No manual context passing is required. ```kotlin class MyApplication : Application() { override fun onCreate() { super.onCreate() // Context is captured by androidx.startup's ContextInitializer // No need to pass it: KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification ), FirebasePush ) } } ``` -------------------------------- ### Get Firebase Push Notification Token Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/03-push-notifications.md Retrieve the push notification token managed by the Firebase-backed notifier. This requires FirebasePush to be initialized. ```kotlin val token = KMPNotifier.firebasePushNotifier.getToken() ``` -------------------------------- ### Accessing Permission Util (1.x vs 2.x) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md Shows the change in accessing the permission utility, moving from a listener method in 1.x to direct property access in 2.x. ```kotlin val listener = object : NotifierManager.Listener { // ... other methods ... } NotifierManager.addListener(listener) val permissionUtil = listener.getPermissionUtil() ``` ```kotlin KMPNotifier.addListener(...) // separate listener val permissionUtil = KMPNotifier.permissionUtil // direct access ``` -------------------------------- ### Registering Listeners Before and After Migration Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/MIGRATION.md Shows the syntax for registering listeners with NotifierManager before migration and the updated approach using KMPNotifier and PushListener after migration. Ensure you don't mix old and new listeners to avoid duplicate event handling. ```kotlin // Before: NotifierManager.addListener(object : NotifierManager.Listener { override fun onNewToken(token: String) { ... } override fun onNotificationClicked(data: PayloadData) { ... } }) // After: KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onNotificationClicked(data: PayloadData) { ... } }) KMPNotifier.addPushListener(object : PushListener { override fun onNewToken(token: String) { ... } }) ``` -------------------------------- ### Add Maven Central Repository Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/README.md Configure your root project's build.gradle.kts or settings.gradle to include Maven Central as a repository. ```kotlin repositories { mavenCentral() } ``` -------------------------------- ### Get FCM Token Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/03-push-notifications.md Retrieves the current Firebase Cloud Messaging token. This is a suspend function and returns null on platforms without Firebase support. ```APIDOC ## getToken ### Description Retrieves the current Firebase Cloud Messaging token. ### Method `suspend fun getToken(): String?` ### Parameters None ### Returns - `String?` - The FCM token, or `null` on desktop/web platforms. ### Notes - Must be called from a coroutine context. - Returns `null` on platforms without Firebase (desktop, web). ### Example ```kotlin viewModelScope.launch { val token = KMPNotifier.firebasePushNotifier.getToken() if (token != null) { println("Current token: $token") } } ``` ``` -------------------------------- ### Listen for Push Notifications and Clicks Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/03-push-notifications.md Set up listeners for new push tokens, incoming push notifications with payload data, and notification click events. This snippet also demonstrates subscribing to broadcast topics. ```kotlin import kotlinx.coroutines.viewModelScope class AppViewModel : ViewModel() { init { // Listen for push events FirebasePush.addListener(object : PushListener { override fun onNewToken(token: String) { viewModelScope.launch { sendTokenToServer(token) } } override fun onPushNotificationWithPayloadData(title: String?, body: String?, data: PayloadData) { val orderId = data["orderId"] as? String if (orderId != null) { updateUI(title, body, orderId) } } }) // Listen for notification clicks KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onNotificationClicked(data: PayloadData) { val orderId = data["orderId"] as? String if (orderId != null) { navigateToOrder(orderId) } } }) // Subscribe to broadcast topics viewModelScope.launch { KMPNotifier.firebasePushNotifier.subscribeToTopic("news") } } } ``` -------------------------------- ### Unified Listener Migration (1.x vs 2.x) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/09-deprecated-api.md Demonstrates the migration of a unified listener in KMPNotifier 1.x to separate listeners for shared and push events in version 2.x. ```kotlin NotifierManager.addListener(object : NotifierManager.Listener { override fun onNotificationClicked(data: PayloadData) { println("Clicked: $data") } override fun onNewToken(token: String) { println("Token: $token") } override fun onPushNotification(title: String?, body: String?) { println("Push: $title / $body") } }) ``` ```kotlin // Shared events (clicks, actions): KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onNotificationClicked(data: PayloadData) { println("Clicked: $data") } }) // Push events: KMPNotifier.addPushListener(object : PushListener { override fun onNewToken(token: String) { println("Token: $token") } override fun onPushNotification(title: String?, body: String?) { println("Push: $title / $body") } }) ``` -------------------------------- ### Swift Call Sites Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/MIGRATION.md Illustrates how to call KMPNotifier methods from Swift in version 2.0, including event handling and accessing notifiers, compared to the 1.x syntax. ```APIDOC ## Swift Call Sites ### Description This section provides examples of how to interact with KMPNotifier from Swift code in version 2.0. It covers direct method calls for event handling and accessing notifier instances, contrasting with the previous version's approach. ### Method Various methods and properties accessible via `KMPNotifier.shared` or specific extension singletons. ### Endpoint N/A (This is an SDK API mapping, not an HTTP endpoint) ### Parameters Refer to specific method signatures for parameter details. ### Request Example ```swift // Handling remote notifications: // Before (1.x): NotifierManager.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo) // After (2.0): KMPNotifier.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo) // Registering a push listener: KMPNotifier.shared.addPushListener(listener: myPushListener) // Accessing notifiers: let localNotifier = KMPNotifier.shared.localNotifier let pushNotifier = KMPNotifier.shared.firebasePushNotifier // Alternative notifier access: let localNotifierAlt = LocalNotifications.shared.notifier let pushNotifierAlt = FirebasePush.shared.notifier ``` ### Response No explicit response schemas are documented for these calls. Behavior depends on the specific method invoked. ``` -------------------------------- ### Initialize KMPNotifier with Local and Firebase Push (Android) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/01-kmpnotifier-facade.md Initialize KMPNotifier with both local notifications and Firebase push notifications on Android. LocalNotifications are automatically installed when FirebasePush is included. ```kotlin KMPNotifier.initialize( configuration = NotificationPlatformConfiguration.Android( notificationIconResId = R.drawable.ic_notification ), FirebasePush // installs LocalNotifications automatically ) ``` -------------------------------- ### Desktop Notification Configuration Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/11-quick-start.md Configure desktop notification settings, specifying the path to the notification icon. ```kotlin NotificationPlatformConfiguration.Desktop( notificationIconPath = "path/to/icon.png" ) ``` -------------------------------- ### Manage Firebase Push Tokens Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/00-index.md Manage Firebase push tokens using KMPNotifier. Includes methods to get the current token, subscribe/unsubscribe from topics, and delete the token. ```kotlin val token = KMPNotifier.firebasePushNotifier.getToken() ``` ```kotlin KMPNotifier.firebasePushNotifier.subscribeToTopic("topic") ``` ```kotlin KMPNotifier.firebasePushNotifier.unSubscribeFromTopic("topic") ``` ```kotlin KMPNotifier.firebasePushNotifier.deleteMyToken() ``` -------------------------------- ### Initialize KMPNotifier with Local Notifications Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/README.md Initialize the KMPNotifier library with the platform configuration and the LocalNotifications capability. This is for local-only usage. ```kotlin KMPNotifier.initialize(configuration, LocalNotifications) ``` -------------------------------- ### Create Notification Action with Text Input Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/02-local-notifications.md Use this constructor to create a notification action that allows users to input text directly. The `inputLabel` provides a placeholder for the text field. ```kotlin NotificationAction(id = "REPLY", title = "Reply", allowsTextInput = true, inputLabel = "Message…") ``` -------------------------------- ### Get FCM Token Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/03-push-notifications.md Retrieves the current Firebase Cloud Messaging token. Must be called from a coroutine context. Returns null on platforms without Firebase (desktop, web). ```kotlin viewModelScope.launch { val token = KMPNotifier.firebasePushNotifier.getToken() if (token != null) { println("Current token: $token") } } ``` -------------------------------- ### Schedule a Simple Notification (Legacy) Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/02-local-notifications.md A legacy method for scheduling notifications with a title, body, and a specific firing time in epoch milliseconds. It is recommended to use the builder DSL with `scheduledAt` for new implementations. ```kotlin KMPNotifier.localNotifier.scheduleSimple( title = "Simple scheduled", body = "This is a simple notification.", fireAt = System.currentTimeMillis() + 60000 // Fire in 1 minute ) ``` -------------------------------- ### Add KMPNotifier Listener Source: https://github.com/mirzemehdi/kmpnotifier/blob/main/_autodocs/01-kmpnotifier-facade.md Add a listener to KMPNotifier to handle notification actions. This example demonstrates how to process different action IDs and extract user input from text-based actions. ```kotlin KMPNotifier.addListener(object : KMPNotifier.Listener { override fun onAction(actionId: String, notificationId: Int, payload: PayloadData) { when (actionId) { "REPLY" -> { val userInput = payload["remote_input"] as? String println("User replied: $userInput") } "OPEN" -> { val url = payload[Notifier.KEY_URL] as? String navigateToUrl(url) } } } }) ```