KMPNotifier

Main entry point of the KMPNotifier library.

Initialize it once on application start, passing the platform configuration and the capabilities (extensions) you want to use:

// Local notifications only:
KMPNotifier.initialize(configuration, LocalNotifications)

// Local + Firebase push (android/ios, requires kmpnotifier-push-firebase):
KMPNotifier.initialize(configuration, FirebasePush)

Local notifications are then available through KMPNotifier.localNotifier (or LocalNotifications.notifier), and push through KMPNotifier.firebasePushNotifier (or FirebasePush.notifier).

Types

Link copied to clipboard
interface Listener

Shared notification events, fired for both local and push notifications.

Properties

Link copied to clipboard

Whether initialize has been called.

Link copied to clipboard

Permission util to check and ask notification permission. On Android, runtime permission must be requested in an Activity — see ComponentActivity.permissionUtil().

Functions

Link copied to clipboard

Adds a listener for shared notification events.

Link copied to clipboard

Initializes the library. Call on application start.

Initializes the library. Call on application start. On iOS call it from the main thread (e.g. in didFinishLaunchingWithOptions) — the notification-center delegate is installed during initialization. Calling it again is a no-op for the configuration; extensions not yet installed are still installed.

Link copied to clipboard
fun KMPNotifier.initialize(context: Context, configuration: NotificationPlatformConfiguration, vararg extensions: KMPNotifierExtension)
Link copied to clipboard

In order to receive notification data payload this function needs to be called in Android side in launcher Activity #onCreate and #onNewIntent methods.

Link copied to clipboard
fun KMPNotifier.onNotificationClicked(notificationContent: UNNotificationContent)

Emits the notification-clicked event for the given notification content.

Link copied to clipboard

Removes a previously added listener.

Link copied to clipboard

Replaces all listeners with the given one. Pass null to remove all listeners.

Link copied to clipboard
fun setLogger(logger: Logger)

Sets a logger for the library's internal logs. By default nothing is logged.