Skip to content

Notification

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channel =
NotificationChannel(
"channel_id",
"channel_name",
NotificationManager.IMPORTANCE_HIGH
)
notificationManager.createNotificationChannel(channel)
val notification =
NotificationCompat.Builder(context, channelId)
.setContentTitle("hello")
.setContentText("hello")
.setSmallIcon(R.drawable.play)
.build()
notificationManager.notify(<notificationId: Int>, notification)