MessagingStyle
setShowWhen(true)
NotificationCompat.Builder
RemoteViews
DecoratedCustomViewStyle
DecoratedMediaCustomViewStyle
setCustomContentView()
Activity
Service
BroadcastReceiver
RemoteInput
Action
// Where should direct replies be put in the intent bundle (can be any string) private static final String KEY_TEXT_REPLY = "key_text_reply"; // Create the RemoteInput specifying this key String replyLabel = getString(R.string.reply_label); RemoteInput remoteInput = new RemoteInput.Builder(KEY_TEXT_REPLY) .setLabel(replyLabel) .build();
addRemoteInput()
setAllowGeneratedReplies(true)
// Add to your action, enabling Direct Reply for it NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.reply, replyLabel, pendingIntent) .addRemoteInput(remoteInput) .setAllowGeneratedReplies(true) .build();
pendingIntent
RemoteInput.getResultsFromIntent()
private CharSequence getMessageText(Intent intent) { Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); if (remoteInput != null) { return remoteInput.getCharSequence(KEY_TEXT_REPLY); } return null; }
setRemoteInputHistory()
addMessage()
builder.setStyle(new NotificationCompat.MessagingStyle("Me") .setConversationTitle("Team lunch") .addMessage("Hi", timestampMillis1, null) // Pass in null for user. .addMessage("What's up?", timestampMillis2, "Coworker") .addMessage("Not much", timestampMillis3, null) .addMessage("How about lunch?", timestampMillis4, "Coworker"));
BigTextStyle
setGroup()
setGroupSummary(true)
InboxStyle
NotificationCompat