Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

WearableExtender

class WearableExtender : NotificationCompat.Extender
kotlin.Any
   ↳ androidx.core.app.NotificationCompat.WearableExtender

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 NotificationCompat.Builder#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 Int

Sentinel value for use with setHintScreenTimeout to keep the screen on for a longer amount of time when this notification is displayed on the screen.

static Int

Sentinel value for use with setHintScreenTimeout to keep the screen on for a short amount of time when this notification is displayed on the screen.

static Int

Size value for use with setCustomSizePreset to show this notification with default sizing.

static Int

Size value for use with setCustomSizePreset to show this notification full screen.

static Int

Size value for use with setCustomSizePreset to show this notification with a large size.

static Int

Size value for use with setCustomSizePreset to show this notification with a medium size.

static Int

Size value for use with setCustomSizePreset to show this notification with a small size.

static Int

Size value for use with setCustomSizePreset to show this notification with an extra small size.

static Int

Sentinel value for an action index that is unset.

Public constructors

Create a NotificationCompat.WearableExtender with default options.

<init>(@NonNull notification: Notification)

Public methods
NotificationCompat.WearableExtender

Add a wearable action to this notification.

NotificationCompat.WearableExtender

Adds wearable actions to this notification.

NotificationCompat.WearableExtender
addPage(@NonNull page: Notification)

Add an additional page of content to display with this notification.

NotificationCompat.WearableExtender
addPages(@NonNull pages: MutableList<Notification!>)

Add additional pages of content to display with this notification.

NotificationCompat.WearableExtender

Clear all wearable actions present on this builder.

NotificationCompat.WearableExtender

Clear all additional pages present on this builder.

NotificationCompat.WearableExtender

NotificationCompat.Builder

Apply wearable extensions to a notification that is being built.

MutableList<NotificationCompat.Action!>

Get the wearable actions present on this notification.

Bitmap?

Get a background image to be displayed behind the notification content.

String?

Returns the bridge tag of the notification.

Int

Get the index of the notification action, if any, that was specified as the primary action.

Int

Get an icon that goes with the content of this notification.

Int

Get the gravity that the content icon should have within the notification display.

Boolean

Get whether the content intent is available when the wearable device is not connected to a companion device.

Int

Get the custom height in pixels for the display of this notification's content.

Int

Get the custom size preset for the display of this notification out of the available presets found in NotificationCompat.WearableExtender, e.

String?

Returns the dismissal id of the notification.

PendingIntent?

Get the intent to launch inside of an activity view when displaying this notification.

Int

Get the gravity that this notification should have within the available viewport space.

Boolean

Get a hint that this notification's BigPictureStyle (if present) should be converted to low-bit and displayed in ambient mode, especially useful for barcodes and qr codes, as well as other simple black-and-white tickets.

Boolean

Get a hint that this notification's background should not be clipped if possible, and should instead be resized to fully display on the screen, retaining the aspect ratio of the image.

Boolean