Created
May 3, 2017 13:13
-
-
Save smaugho/d42f4b47be8c19034907f7dde642a05d to your computer and use it in GitHub Desktop.
Notifications Action Example
This file contains 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
//Prepare the intent | |
Intent intent = $MainActivity().intent() | |
.flags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK) | |
.get(); | |
//Prepare pending intent | |
PendingIntent contentIntent = PendingIntent.getActivity( | |
this, 0, notificationIntent, | |
PendingIntent.FLAG_CANCEL_CURRENT); | |
//Send notification | |
$Notification(NOTIFICATION_ID) | |
.contentTitle("Notification title") | |
.contentText("Notification Text") | |
.smallIcon(R.drawable.app_icon) | |
.contentIntent(contentIntent) | |
.autoCancel(true) | |
.defaults(Notification.DEFAULT_SOUND); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment