

Getting Started
Adding dependencies
- Add it in your
commonMain.dependencies :
implementation("io.github.shadmanadman:knotif:0.68.0")
Message notification
Note: In Android and iOS you need to set your app_icon and app_name inside AndroidManifest.xml and Info.plist respectively.
val messageData = KNotifMessageData(
id = "1",
title = "This is a test",
appName = "Knotif",
message = "This is a test message",
poster = imageResource(Res.drawable.default_poster),
appIcon = imageResource(Res.drawable.default_app_icon),
)
// Show the notification
Knotif.show(messageData)
// Dismiss the notification
Knotif.dismiss(messageData.id)
// Dismiss all notifications
Knotif.dismissAll()
// Set a listener to be called when a notification is clicked
Knotif.setOnBuildMessageKnotifListener {
println("notification clicked ${it}")
}
How it looks

Music notification
Note: This notification style for Android and iOS will be replaced with the new system music notification style in the future.
val musicData = KNotifMusicData(
= ,
= ,
= ,
= MusicIcons(
= poster,
= playIcon,
= pauseIcon,
= nextIcon,
= previousIcon
),
= ,
= ,
= appIcon,
)
// Show the notification
Knotif.show(musicData)
// Dismiss the notification
Knotif.dismiss(messageData.id)
// Dismiss all notifications
Knotif.dismissAll()
// Set a listener
Knotif.setOnBuildMusicKnotifListener(
= {},
= {},
= {},
= {})
How it looks

Progress notification
val progressData = KNotifProgressData(
id = "1",
title = "This is a test",
description = "This is a test description",
appName = "Knotif",
progress = 50,
appIcon = appIcon
)
// Show the notification
Knotif.show(progressData)
// Dismiss the notification
Knotif.dismiss(progressData.id)
// Dismiss all notifications
Knotif.dismissAll()
// Set a listener to be called when a notification is clicked
Knotif.setOnBuildProgressKnotifListener {
println("notification clicked ${it}")
}
How it looks
