NotificationCompat.WearableExtender

public final class NotificationCompat.WearableExtender implements NotificationCompat.Extender


Helper class to add wearable extensions to notifications.

See Creating Notifications for Android Wear for more information on how to use this class.

To create a notification with wearable extensions:

  1. Create a NotificationCompat.Builder, setting any desired properties.
  2. Create a NotificationCompat.WearableExtender.
  3. Set wearable-specific properties using the add and set methods of NotificationCompat.WearableExtender.
  4. Call extend to apply the extensions to a notification.
  5. Post the notification to the notification system with the NotificationManagerCompat.notify(...) methods and not the NotificationManager.notify(...) methods.
Notification notification = new NotificationCompat.Builder(mContext)
        .setContentTitle("New mail from " + sender.toString())
        .setContentText(subject)
        .setSmallIcon(R.drawable.new_mail)
        .extend(new NotificationCompat.WearableExtender()
                .setContentIcon(R.drawable.new_mail))
        .build();
NotificationManagerCompat.from(mContext).notify(0, notification);

Wearable extensions can be accessed on an existing notification by using the WearableExtender(Notification) constructor, and then using the get methods to access values.

NotificationCompat.WearableExtender wearableExtender =
        new NotificationCompat.WearableExtender(notification);
List<Notification> pages = wearableExtender.getPages();

Summary

Constants

static final int

This field is deprecated.

This feature is no longer supported.

static final int

This field is deprecated.

This feature is no longer supported.

static final int

This field is deprecated.

Display intents are no longer supported.

static final int

This field is deprecated.

Display intents are no longer supported.

static final int

This field is deprecated.

Display intents are no longer supported.

static final int

This field is deprecated.

Display intents are no longer supported.

static final int

This field is deprecated.

Display intents are no longer supported.

static final int

This field is deprecated.

Display intents are no longer supported.

static final int

Sentinel value for an action index that is unset.

Public constructors

Create a NotificationCompat.WearableExtender with default options.

Public methods