Skip to content

Instantly share code, notes, and snippets.

@Arunshaik2001
Created November 21, 2022 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arunshaik2001/87f898ca38fe186880adedb0cefe2234 to your computer and use it in GitHub Desktop.
Save Arunshaik2001/87f898ca38fe186880adedb0cefe2234 to your computer and use it in GitHub Desktop.
fun createNotificationWithConversationText(context: Context){
val message1 = NotificationCompat.MessagingStyle.Message("Hi, there",
12345L,
"Martin")
val message2 = NotificationCompat.MessagingStyle.Message("Hello",
12345L,
"You")
val notification = NotificationCompat.Builder(context, NotificationChannels.CHANNEL1)
.setSmallIcon(R.drawable.desk)
.setStyle(NotificationCompat.MessagingStyle("Arun")
.addMessage(message1)
.addMessage(message2))
.build()
with(NotificationManagerCompat.from(context)) {
notify(12544567, notification)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment