Last active
January 4, 2020 19:29
-
-
Save Lavanyagaur22/467395f46ebee5b98f3409e078f7f345 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an intent | |
val i = Intent() | |
i.action = Intent.ACTION_VIEW | |
i.data = Uri.parse("https://www.google.com") | |
// Craete a pending intent | |
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!") | |
// Set the intent that will fire when the user taps the notification | |
.setContentIntent(pi) | |
.setAutoCancel(true) | |
.setPriority(NotificationCompat.PRIORITY_DEFAULT).build() | |
nm.notify(2, actionedNotification) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment