and Wearable notificationBuilder = .addAction(iconRes, "ActionTitle", pendingIntentAction1); // show the notification notificationManager.notify(notificationId, notificationBuilder.build()); // create notification using a builder NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setContentTitle("Title") .setContentText("Short message") .setContextnIntent(pendingIntent) ...;
to the notification notificationBuilder.extend(wearableAction); // show the notification just on the Phone notificationBuilder.setLocalOnly(true); // create the Wearable action NotificationCompat.Action wearableAction = new NotificationCompat.Action.Builder(iconRes, "WearableActionTitle", pendingIntentAction2)) .build();
secondPageNotification = new NotificationCompat.Builder(this) .setContentText("2nd Page Context")... .build(); // Wrap second page in WearableExtender and extend // the main notification Notification twoPagesNotification = new WearableExtender() .addPage(secondPageNotification) .extend(notificationBuilder) .build(); notificationManager.notify(notificationId, twoPagesNotification);
action and add the remote input NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon, getString(R.string.label, replyPendingIntent)) .addRemoteInput(remoteInput) .build(); // Build the notification and add the action via WearableExtender Notification notification = new NotificationCompat.Builder(mContext) ... .extend(new WearableExtender().addAction(action)) .build();