Skip to content

Instantly share code, notes, and snippets.

@5AbhishekSaxena
Created June 5, 2023 19:40
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 5AbhishekSaxena/01d4cd88643ee476114ceac20a347df5 to your computer and use it in GitHub Desktop.
Save 5AbhishekSaxena/01d4cd88643ee476114ceac20a347df5 to your computer and use it in GitHub Desktop.
private fun buildSimpleNotification(): Notification {
val pendingIntent: PendingIntent = getPendingIntent()
val builder = NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_android_black_24dp)
.setContentTitle("Sample notification")
.setContentText("This is the long content of the notification. Happy coding.")
.setStyle(
NotificationCompat.BigTextStyle()
.bigText("This is much bigger content of the notification. Happy coding!")
)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(pendingIntent)
return builder.build()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment