Код: Выделить всё
val notificationView = RemoteViews(context.packageName , R.layout.notification_item)
val notificationViewBig = RemoteViews(context.packageName , R.layout.notification_item_big)
val intent = Intent(context,NotificationBroadCastReciever::class.java).apply {
putExtra("notificationID",matchId.hashCode())
}
val pendingIntent = PendingIntent.getBroadcast(context,0,intent,
PendingIntent.FLAG_IMMUTABLE)
val notificationBuilder = NotificationCompat.Builder(context,"main_chanel")
.setSmallIcon(R.drawable.ic_launcher_foreground) // todo: change
.addAction(R.drawable.albania,"stop watching",pendingIntent)
.setCustomContentView(notificationView)
.setCustomBigContentView(notificationViewBig)
.setOngoing(true)
.setPriority(Notification.PRIORITY_MAX)
.setWhen(0)
.build()
Подробнее здесь: https://stackoverflow.com/questions/790 ... stomview-f
Мобильная версия