Android custom layout for push notification view
notification_layout.xml, the layout to be used for the push notification view.
Inflate the push notification layout using RemoteViews and build the notification.
val contentView = RemoteViews(packageName, R.layout.notification_layout)
val mBuilder = NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("collapsed title")
.setContentText("collapsed text")
.setCustomBigContentView(contentView)
val notification = mBuilder.build()
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.notify(1, notification)
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts