Last active
August 29, 2015 13:58
-
-
Save SeanPONeil/10174462 to your computer and use it in GitHub Desktop.
Display Notification with actions
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
public void displayNotificationWithActions() { | |
mNotifyBuilder = new NotificationCompat.Builder(this) | |
.setContentTitle("New Message") | |
.setContentText("You've received new messages.") | |
.setSmallIcon(R.drawable.ic_notify_status); | |
// Create Pending Intent that broadcasts an Intent | |
Intent intent = new Intent(context.getPackageName() + ".READ_MESSAGE"); | |
PendingIntent pendingIntent = | |
PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); | |
mNotifyBuilder.addAction(R.drawable.ic_checkmark, "Read message", pendingIntent); | |
mNotificationManager.notify( | |
notifyID, mNotifyBuilder.build()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment