original source: http://www.androiddocs.com/training/wearables/notifications/pages.html

Adding Pages to a Notification

additional pages appear immediately to the right of the main notification card.

To create a notification with multiple pages:

  1. Create the main notification (the first page) with NotificationCompat.Builder, in the way you’d like the notification to appear on a handset.
  2. Create the additional pages for the wearable with NotificationCompat.Builder.
  3. Apply the pages to the main notification with the addPage() method or add multiple pages in a Collectionwith the addPages() method.

// Create builder for the main notification
NotificationCompat.Builder notificationBuilder =
       new NotificationCompat.Builder(this)
       .setContentTitle("Page 1")
       .setContentText("Short message")

// Create a big text style for the second page
BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
secondPageStyle.setBigContentTitle("Page 2")
              .bigText("A lot of text...");

// Create second page notification
Notification secondPageNotification =
       new NotificationCompat.Builder(this)

// Extend the notification builder with the second page
Notification notification = notificationBuilder
       .extend(new NotificationCompat.WearableExtender()

// Issue the notification
notificationManager =
notificationManager.notify(notificationId, notification);

Comments are closed.

Post Navigation