Skip to content

Instantly share code, notes, and snippets.

@Lavanyagaur22
Last active January 4, 2020 19:33
Show Gist options
  • Save Lavanyagaur22/b6347d67a6d3c9b56b89de7e155b031d to your computer and use it in GitHub Desktop.
Save Lavanyagaur22/b6347d67a6d3c9b56b89de7e155b031d to your computer and use it in GitHub Desktop.
val i = Intent()
i.action = Intent.ACTION_VIEW
i.data = Uri.parse("https://www.google.com")
val pi: PendingIntent =
PendingIntent.getActivity(this, 12345, i, PendingIntent.FLAG_UPDATE_CURRENT)
val actionedNotification = NotificationCompat.Builder(this, "first")
.setSmallIcon(R.drawable.ic_launcher_foreground)
.setContentTitle("Hello There")
.setContentText("General Master!")
.addAction(R.mipmap.ic_launcher, "Snooze", pi)
.setPriority(NotificationCompat.PRIORITY_DEFAULT).build()
nm.notify(4, actionedNotification)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment