Skip to content

Instantly share code, notes, and snippets.

@SeanPONeil
Last active August 29, 2015 13:58
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 SeanPONeil/10174462 to your computer and use it in GitHub Desktop.
Save SeanPONeil/10174462 to your computer and use it in GitHub Desktop.
Display Notification with actions
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