Notification.WearableExtender
public
static
final
class
Notification.WearableExtender
extends Object
implements
Notification.Extender
| java.lang.Object | |
| ↳ | android.app.Notification.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:
- Create a
Notification.Builder, setting any desired properties. - Create a
Notification.WearableExtender. - Set wearable-specific properties using the
addandsetmethods ofNotification.WearableExtender. - Call
extend(Notification.Extender)to apply the extensions to a notification. - Post the notification to the notification system with the
NotificationManager.notify(...)methods.
Notification notif = new Notification.Builder(mContext)
.setContentTitle("New mail from " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail)
.extend(new Notification.WearableExtender()
.setContentIcon(R.drawable.new_mail))
.build();
NotificationManager notificationManger =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManger.notify(0, notif);
Wearable extensions can be accessed on an existing notification by using the
WearableExtender(Notification) constructor,
and then using the get methods to access values.
Notification.WearableExtender wearableExtender = new Notification.WearableExtender(
notification);
List<Notification> pages = wearableExtender.getPages();
Summary
Constants | |
|---|---|
int |
SCREEN_TIMEOUT_LONG
Sentinel value for use with |
int |
SCREEN_TIMEOUT_SHORT
Sentinel value for use with |
int |
SIZE_DEFAULT
Size value for use with |
int |
SIZE_FULL_SCREEN
Size value for use with |
int |
SIZE_LARGE
Size value for use with |
int |
SIZE_MEDIUM
Size value for use with |
int |
SIZE_SMALL
Size value for use with |
int |
SIZE_XSMALL
Size value for use with |
int |
UNSET_ACTION_INDEX
Sentinel value for an action index that is unset. |
Public constructors | |
|---|---|
Notification.WearableExtender()
Create a |
|
Notification.WearableExtender(Notification notif)
|
|
Public methods | |
|---|---|
Notification.WearableExtender
|
addAction(Notification.Action action)
Add a wearable action to this notification. |
Notification.WearableExtender
|
addActions(List<Notification.Action> actions)
Adds wearable actions to this notification. |
Notification.WearableExtender
|
addPage(Notification page)
Add an additional page of content to display with this notification. |
Notification.WearableExtender
|
addPages(List<Notification> pages)
Add additional pages of content to display with this notification. |
Notification.WearableExtender
|
clearActions()
Clear all wearable actions present on this builder. |
Notification.WearableExtender
|
clearPages()
Clear all additional pages present on this builder. |
Notification.WearableExtender
|
clone()
Creates and returns a copy of this object. |
Notification.Builder
|
extend(Notification.Builder builder)
Apply wearable extensions to a notification that is being built. |
List<Notification.Action>
|
getActions()
Get the wearable actions present on this notification. |
Bitmap
|
getBackground()
Get a background image to be displayed behind the notification content. |
String
|
getBridgeTag()
Returns the bridge tag of the notification. |
int
|
getContentAction()
Get the index of the notification action, if any, that was specified as being clickable with the content of this notification. |
int
|
getContentIcon()
Get an icon that goes with the content of this notification. |
int
|
getContentIconGravity()
Get the gravity that the content icon should have within the notification display. |
boolean
|
getContentIntentAvailableOffline()
Get whether the content intent is available when the wearable device is not connected to a companion device. |
int
|
getCustomContentHeight()
Get the custom height in pixels for the display of this notification's content. |
int
|
getCustomSizePreset()
Get the custom size preset for the display of this notification out of the available
presets found in |
String
|
getDismissalId()
Returns the dismissal id of the notification. |
PendingIntent
|
getDisplayIntent()
Get the intent to launch inside of an activity view when displaying this notification. |
int
|
getGravity()
Get the gravity that this notification should have within the available viewport space. |
boolean
|
getHintAmbientBigPicture()
Get a hint that this notification's |
boolean
|
getHintAvoidBackgroundClipping()
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
|
getHintContentIntentLaunchesActivity()
Get a hint that this notification's content intent will launch an |
boolean
|
getHintHideIcon()
Get a hint that this notification's icon should not be displayed. |
int
|
getHintScreenTimeout()
Get the duration, in milliseconds, that the screen should remain on for when this notification is displayed. |
boolean
|
getHintShowBackgroundOnly()
Get a visual hint that only the background image of this notification should be displayed, and other semantic content should be hidden. |
List<Notification>
|
getPages()
Get the array of additional pages of content for displaying this notification. |
boolean
|
getStartScrollBottom()
Get whether the scrolling position for the contents of this notification should start at the bottom of the contents instead of the top when the contents are too long to display within the screen. |
Notification.WearableExtender
|
setBackground(Bitmap background)
Set a background image to be displayed behind the notification content. |
Notification.WearableExtender
|
setBridgeTag(String bridgeTag)
Sets a bridge tag for this notification. |
Notification.WearableExtender
|
setContentAction(int actionIndex)
Set an action from this notification's actions to be clickable with the content of this notification. |
Notification.WearableExtender
|
setContentIcon(int icon)
Set an icon that goes with the content of this notification. |
Notification.WearableExtender
|
setContentIconGravity(int contentIconGravity)
Set the gravity that the content icon should have within the notification display. |
Notification.WearableExtender
|
setContentIntentAvailableOffline(boolean contentIntentAvailableOffline)
Set whether the content intent is available when the wearable device is not connected to a companion device. |
Notification.WearableExtender
|
setCustomContentHeight(int height)
Set the custom height in pixels for the display of this notification's content. |
Notification.WearableExtender
|
setCustomSizePreset(int sizePreset)
Set the custom size preset for the display of this notification out of the available
presets found in |
Notification.WearableExtender
|
setDismissalId(String dismissalId)
Sets the dismissal id for this notification. |
Notification.WearableExtender
|
setDisplayIntent(PendingIntent intent)
Set an intent to launch inside of an activity view when displaying this notification. |
Notification.WearableExtender
|
setGravity(int gravity)
Set the gravity that this notification should have within the available viewport space. |
Notification.WearableExtender
|
setHintAmbientBigPicture(boolean hintAmbientBigPicture)
Set a hint that this notification's |
Notification.WearableExtender
|
setHintAvoidBackgroundClipping(boolean hintAvoidBackgroundClipping)
Set 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. |
Notification.WearableExtender
|
setHintContentIntentLaunchesActivity(boolean hintContentIntentLaunchesActivity)
Set a hint that this notification's content intent will launch an |
Notification.WearableExtender
|
setHintHideIcon(boolean hintHideIcon)
Set a hint that this notification's icon should not be displayed. |
Notification.WearableExtender
|
setHintScreenTimeout(int timeout)
Set a hint that the screen should remain on for at least this duration when this notification is displayed on the screen. |
Notification.WearableExtender
|
setHintShowBackgroundOnly(boolean hintShowBackgroundOnly)
Set a visual hint that only the background image of this notification should be displayed, and other semantic content should be hidden. |
Notification.WearableExtender
|
setStartScrollBottom(boolean startScrollBottom)
Set whether the scrolling position for the contents of this notification should start at the bottom of the contents instead of the top when the contents are too long to display within the screen. |
Inherited methods | |
|---|---|
java.lang.Object
| |
android.app.Notification.Extender
| |
Constants
SCREEN_TIMEOUT_LONG
int SCREEN_TIMEOUT_LONG
Sentinel value for use with setHintScreenTimeout(int) to keep the screen on
for a longer amount of time when this notification is displayed on the screen.
Constant Value: -1 (0xffffffff)
SCREEN_TIMEOUT_SHORT
int SCREEN_TIMEOUT_SHORT
Sentinel value for use with setHintScreenTimeout(int) to keep the screen on for a
short amount of time when this notification is displayed on the screen. This
is the default value.
Constant Value: 0 (0x00000000)
SIZE_DEFAULT
int SIZE_DEFAULT
Size value for use with setCustomSizePreset(int) to show this notification with
default sizing.
For custom display notifications created using setDisplayIntent(PendingIntent),
the default is SIZE_MEDIUM. All other notifications size automatically based
on their content.
Constant Value: 0 (0x00000000)
SIZE_FULL_SCREEN
int SIZE_FULL_SCREEN
Size value for use with setCustomSizePreset(int) to show this notification
full screen.
This value is only applicable for custom display notifications created using
setDisplayIntent(PendingIntent).
Constant Value: 5 (0x00000005)
SIZE_LARGE
int SIZE_LARGE
Size value for use with setCustomSizePreset(int) to show this notification
with a large size.
This value is only applicable for custom display notifications created using
setDisplayIntent(PendingIntent).
Constant Value: 4 (0x00000004)
SIZE_MEDIUM
int SIZE_MEDIUM
Size value for use with setCustomSizePreset(int) to show this notification
with a medium size.
This value is only applicable for custom display notifications created using
setDisplayIntent(PendingIntent).
Constant Value: 3 (0x00000003)
SIZE_SMALL
int SIZE_SMALL
Size value for use with setCustomSizePreset(int) to show this notification
with a small size.
This value is only applicable for custom display notifications created using
setDisplayIntent(PendingIntent).
Constant Value: 2 (0x00000002)
SIZE_XSMALL
int SIZE_XSMALL
Size value for use with setCustomSizePreset(int) to show this notification
with an extra small size.
This value is only applicable for custom display notifications created using
setDisplayIntent(PendingIntent).
Constant Value: 1 (0x00000001)
UNSET_ACTION_INDEX
int UNSET_ACTION_INDEX
Sentinel value for an action index that is unset.
Constant Value: -1 (0xffffffff)
Public constructors
Notification.WearableExtender
Notification.WearableExtender ()
Create a Notification.WearableExtender with default
options.
Notification.WearableExtender
Notification.WearableExtender (Notification notif)
| Parameters | |
|---|---|
notif |
Notification |
Public methods
addAction
Notification.WearableExtender addAction (Notification.Action action)
Add a wearable action to this notification.
When wearable actions are added using this method, the set of actions that
show on a wearable device splits from devices that only show actions added
using addAction(Notification.Action). This allows for customization
of which actions display on different devices.
| Parameters | |
|---|---|
action |
Notification.Action: the action to add to this notification |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
See also:
addActions
Notification.WearableExtender addActions (List<Notification.Action> actions)
Adds wearable actions to this notification.
When wearable actions are added using this method, the set of actions that
show on a wearable device splits from devices that only show actions added
using addAction(Notification.Action). This allows for customization
of which actions display on different devices.
| Parameters | |
|---|---|
actions |
List: the actions to add to this notification |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
See also:
addPage
Notification.WearableExtender addPage (Notification page)
Add an additional page of content to display with this notification. The current notification forms the first page, and pages added using this function form subsequent pages. This field can be used to separate a notification into multiple sections.
| Parameters | |
|---|---|
page |
Notification: the notification to add as another page |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
See also:
addPages
Notification.WearableExtender addPages (List<Notification> pages)
Add additional pages of content to display with this notification. The current notification forms the first page, and pages added using this function form subsequent pages. This field can be used to separate a notification into multiple sections.
| Parameters | |
|---|---|
pages |
List: a list of notifications |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
See also:
clearActions
Notification.WearableExtender clearActions ()
Clear all wearable actions present on this builder.
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining. |
See also:
clearPages
Notification.WearableExtender clearPages ()
Clear all additional pages present on this builder.
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining. |
See also:
clone
Notification.WearableExtender clone ()
Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object x, the expression:
will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x)
true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone. If a class and all of its superclasses (except
Object) obey this convention, it will be the case that
x.clone().getClass() == x.getClass().
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by super.clone before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by super.clone
need to be modified.
The method clone for class Object performs a
specific cloning operation. First, if the class of this object does
not implement the interface Cloneable, then a
CloneNotSupportedException is thrown. Note that all arrays
are considered to implement the interface Cloneable and that
the return type of the clone method of an array type T[]
is T[] where T is any reference or primitive type.
Otherwise, this method creates a new instance of the class of this
object and initializes all its fields with exactly the contents of
the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method
performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object does not itself implement the interface
Cloneable, so calling the clone method on an object
whose class is Object will result in throwing an
exception at run time.
| Returns | |
|---|---|
Notification.WearableExtender |
a clone of this instance. |
extend
Notification.Builder extend (Notification.Builder builder)
Apply wearable extensions to a notification that is being built. This is typically
called by the extend(Notification.Extender) method of
Notification.Builder.
| Parameters | |
|---|---|
builder |
Notification.Builder: the builder to be modified. |
| Returns | |
|---|---|
Notification.Builder |
the build object for chaining. |
getActions
List<Notification.Action> getActions ()
Get the wearable actions present on this notification.
| Returns | |
|---|---|
List<Notification.Action> |
|
getBackground
Bitmap getBackground ()
Get a background image to be displayed behind the notification content.
Contrary to the Notification.BigPictureStyle, this background
will work with any notification style.
| Returns | |
|---|---|
Bitmap |
the background image |
See also:
getBridgeTag
String getBridgeTag ()
Returns the bridge tag of the notification.
| Returns | |
|---|---|
String |
the bridge tag or null if not present. |
getContentAction
int getContentAction ()
Get the index of the notification action, if any, that was specified as being clickable with the content of this notification. This action will no longer display separately from the notification's content.
For notifications with multiple pages, child pages can also have content actions set, although the list of available actions comes from the main notification and not from the child page's notification.
If wearable specific actions were added to the main notification, this index will apply to that list, otherwise it will apply to the regular actions list.
| Returns | |
|---|---|
int |
the action index or UNSET_ACTION_INDEX if no action was selected.
|
getContentIcon
int getContentIcon ()
Get an icon that goes with the content of this notification.
| Returns | |
|---|---|
int |
|
getContentIconGravity
int getContentIconGravity ()
Get the gravity that the content icon should have within the notification display.
Supported values include START and
END. The default value is END.
| Returns | |
|---|---|
int |
|
See also:
getContentIntentAvailableOffline
boolean getContentIntentAvailableOffline ()
Get whether the content intent is available when the wearable device is not connected to a companion device. The user can still trigger this intent when the wearable device is offline, but a visual hint will indicate that the content intent may not be available. Defaults to true.
| Returns | |
|---|---|
boolean |
|
getCustomContentHeight
int getCustomContentHeight ()
Get the custom height in pixels for the display of this notification's content.
This option is only available for custom display notifications created
using setDisplayIntent(PendingIntent). See also setCustomSizePreset(int) and
setCustomContentHeight(int).
| Returns | |
|---|---|
int |
|
getCustomSizePreset
int getCustomSizePreset ()
Get the custom size preset for the display of this notification out of the available
presets found in Notification.WearableExtender, e.g.
SIZE_LARGE.
Some custom size presets are only applicable for custom display notifications created
using setDisplayIntent(PendingIntent). Check the documentation for the preset in question.
See also setCustomContentHeight(int) and setCustomSizePreset(int).
| Returns | |
|---|---|
int |
|
getDismissalId
String getDismissalId ()
Returns the dismissal id of the notification.
| Returns | |
|---|---|
String |
the dismissal id of the notification or null if it has not been set. |
getDisplayIntent
PendingIntent getDisplayIntent ()
Get the intent to launch inside of an activity view when displaying this
notification. This PendingIntent should be for an activity.
| Returns | |
|---|---|
PendingIntent |
|
getGravity
int getGravity ()
Get the gravity that this notification should have within the available viewport space.
Supported values include TOP,
CENTER_VERTICAL and BOTTOM.
The default value is BOTTOM.
| Returns | |
|---|---|
int |
|
getHintAmbientBigPicture
boolean getHintAmbientBigPicture ()
Get a hint that this notification's Notification.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.
| Returns | |
|---|---|
boolean |
true if it should be displayed in ambient, false otherwise
otherwise. The default value is false if this was never set.
|
getHintAvoidBackgroundClipping
boolean getHintAvoidBackgroundClipping ()
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. This can be useful for images like barcodes or qr codes.
| Returns | |
|---|---|
boolean |
true if it's ok if the background is clipped on the screen, false
otherwise. The default value is false if this was never set.
|
getHintContentIntentLaunchesActivity
boolean getHintContentIntentLaunchesActivity ()
Get a hint that this notification's content intent will launch an Activity
directly, telling the platform that it can generate the appropriate transitions
| Returns | |
|---|---|
boolean |
true if the content intent will launch an activity and transitions should
be generated, false otherwise. The default value is false if this was never set.
|
getHintHideIcon
boolean getHintHideIcon ()
Get a hint that this notification's icon should not be displayed.
| Returns | |
|---|---|
boolean |
true if this icon should not be displayed, false otherwise.
The default value is false if this was never set.
|
getHintScreenTimeout
int getHintScreenTimeout ()
Get the duration, in milliseconds, that the screen should remain on for when this notification is displayed.
| Returns | |
|---|---|
int |
the duration in milliseconds if > 0, or either one of the sentinel values
SCREEN_TIMEOUT_SHORT or SCREEN_TIMEOUT_LONG.
|
getHintShowBackgroundOnly
boolean getHintShowBackgroundOnly ()
Get a visual hint that only the background image of this notification should be
displayed, and other semantic content should be hidden. This hint is only applicable
to sub-pages added using addPage(Notification).
| Returns | |
|---|---|
boolean |
|
getPages
List<Notification> getPages ()
Get the array of additional pages of content for displaying this notification. The current notification forms the first page, and elements within this array form subsequent pages. This field can be used to separate a notification into multiple sections.
| Returns | |
|---|---|
List<Notification> |
the pages for this notification |
getStartScrollBottom
boolean getStartScrollBottom ()
Get whether the scrolling position for the contents of this notification should start at the bottom of the contents instead of the top when the contents are too long to display within the screen. Default is false (start scroll at the top).
| Returns | |
|---|---|
boolean |
|
setBackground
Notification.WearableExtender setBackground (Bitmap background)
Set a background image to be displayed behind the notification content.
Contrary to the Notification.BigPictureStyle, this background
will work with any notification style.
| Parameters | |
|---|---|
background |
Bitmap: the background bitmap |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
See also:
setBridgeTag
Notification.WearableExtender setBridgeTag (String bridgeTag)
Sets a bridge tag for this notification. A bridge tag can be set for notifications posted from a phone to provide finer-grained control on what notifications are bridged to wearables. See Adding Wearable Features to Notifications for more information.
| Parameters | |
|---|---|
bridgeTag |
String: the bridge tag of the notification. |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
setContentAction
Notification.WearableExtender setContentAction (int actionIndex)
Set an action from this notification's actions to be clickable with the content of this notification. This action will no longer display separately from the notification's content.
For notifications with multiple pages, child pages can also have content actions set, although the list of available actions comes from the main notification and not from the child page's notification.
| Parameters | |
|---|---|
actionIndex |
int: The index of the action to hoist onto the current notification page.
If wearable actions were added to the main notification, this index
will apply to that list, otherwise it will apply to the regular
actions list.
|
| Returns | |
|---|---|
Notification.WearableExtender |
|
setContentIcon
Notification.WearableExtender setContentIcon (int icon)
Set an icon that goes with the content of this notification.
| Parameters | |
|---|---|
icon |
int |
| Returns | |
|---|---|
Notification.WearableExtender |
|
setContentIconGravity
Notification.WearableExtender setContentIconGravity (int contentIconGravity)
Set the gravity that the content icon should have within the notification display.
Supported values include START and
END. The default value is END.
| Parameters | |
|---|---|
contentIconGravity |
int |
| Returns | |
|---|---|
Notification.WearableExtender |
|
See also:
setContentIntentAvailableOffline
Notification.WearableExtender setContentIntentAvailableOffline (boolean contentIntentAvailableOffline)
Set whether the content intent is available when the wearable device is not connected to a companion device. The user can still trigger this intent when the wearable device is offline, but a visual hint will indicate that the content intent may not be available. Defaults to true.
| Parameters | |
|---|---|
contentIntentAvailableOffline |
boolean |
| Returns | |
|---|---|
Notification.WearableExtender |
|
setCustomContentHeight
Notification.WearableExtender setCustomContentHeight (int height)
Set the custom height in pixels for the display of this notification's content.
This option is only available for custom display notifications created
using setDisplayIntent(PendingIntent). See also
setCustomSizePreset(int) and
getCustomContentHeight().
| Parameters | |
|---|---|
height |
int |
| Returns | |
|---|---|
Notification.WearableExtender |
|
setCustomSizePreset
Notification.WearableExtender setCustomSizePreset (int sizePreset)
Set the custom size preset for the display of this notification out of the available
presets found in Notification.WearableExtender, e.g.
SIZE_LARGE.
Some custom size presets are only applicable for custom display notifications created
using setDisplayIntent(PendingIntent). Check the
documentation for the preset in question. See also
setCustomContentHeight(int) and getCustomSizePreset().
| Parameters | |
|---|---|
sizePreset |
int |
| Returns | |
|---|---|
Notification.WearableExtender |
|
setDismissalId
Notification.WearableExtender setDismissalId (String dismissalId)
Sets the dismissal id for this notification. If a notification is posted with a dismissal id, then when that notification is canceled, notifications on other wearables and the paired Android phone having that same dismissal id will also be canceled. See Adding Wearable Features to Notifications for more information.
| Parameters | |
|---|---|
dismissalId |
String: the dismissal id of the notification. |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
setDisplayIntent
Notification.WearableExtender setDisplayIntent (PendingIntent intent)
Set an intent to launch inside of an activity view when displaying
this notification. The PendingIntent provided should be for an activity.
Intent displayIntent = new Intent(context, MyDisplayActivity.class);
PendingIntent displayPendingIntent = PendingIntent.getActivity(context,
0, displayIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification notif = new Notification.Builder(context)
.extend(new Notification.WearableExtender()
.setDisplayIntent(displayPendingIntent)
.setCustomSizePreset(Notification.WearableExtender.SIZE_MEDIUM))
.build();
The activity to launch needs to allow embedding, must be exported, and should have an empty task affinity. It is also recommended to use the device default light theme.
Example AndroidManifest.xml entry:
<activity android:name="com.example.MyDisplayActivity"
android:exported="true"
android:allowEmbedded="true"
android:taskAffinity=""
android:theme="@android:style/Theme.DeviceDefault.Light" />
| Parameters | |
|---|---|
intent |
PendingIntent: the PendingIntent for an activity |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
See also:
setGravity
Notification.WearableExtender setGravity (int gravity)
Set the gravity that this notification should have within the available viewport space.
Supported values include TOP,
CENTER_VERTICAL and BOTTOM.
The default value is BOTTOM.
| Parameters | |
|---|---|
gravity |
int |
| Returns | |
|---|---|
Notification.WearableExtender |
|
setHintAmbientBigPicture
Notification.WearableExtender setHintAmbientBigPicture (boolean hintAmbientBigPicture)
Set a hint that this notification's Notification.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.
| Parameters | |
|---|---|
hintAmbientBigPicture |
boolean: true to enable converstion and ambient. |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
setHintAvoidBackgroundClipping
Notification.WearableExtender setHintAvoidBackgroundClipping (boolean hintAvoidBackgroundClipping)
Set 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. This can be useful for images like barcodes or qr codes.
| Parameters | |
|---|---|
hintAvoidBackgroundClipping |
boolean: true to avoid clipping if possible. |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
setHintContentIntentLaunchesActivity
Notification.WearableExtender setHintContentIntentLaunchesActivity (boolean hintContentIntentLaunchesActivity)
Set a hint that this notification's content intent will launch an Activity
directly, telling the platform that it can generate the appropriate transitions.
| Parameters | |
|---|---|
hintContentIntentLaunchesActivity |
boolean: true if the content intent will launch
an activity and transitions should be generated, false otherwise. |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
setHintHideIcon
Notification.WearableExtender setHintHideIcon (boolean hintHideIcon)
Set a hint that this notification's icon should not be displayed.
| Parameters | |
|---|---|
hintHideIcon |
boolean: true to hide the icon, false otherwise. |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
setHintScreenTimeout
Notification.WearableExtender setHintScreenTimeout (int timeout)
Set a hint that the screen should remain on for at least this duration when this notification is displayed on the screen.
| Parameters | |
|---|---|
timeout |
int: The requested screen timeout in milliseconds. Can also be either
SCREEN_TIMEOUT_SHORT or SCREEN_TIMEOUT_LONG. |
| Returns | |
|---|---|
Notification.WearableExtender |
this object for method chaining |
setHintShowBackgroundOnly
Notification.WearableExtender setHintShowBackgroundOnly (boolean hintShowBackgroundOnly)
Set a visual hint that only the background image of this notification should be
displayed, and other semantic content should be hidden. This hint is only applicable
to sub-pages added using addPage(Notification).
| Parameters | |
|---|---|
hintShowBackgroundOnly |
boolean |
| Returns | |
|---|---|
Notification.WearableExtender |
|
setStartScrollBottom
Notification.WearableExtender setStartScrollBottom (boolean startScrollBottom)
Set whether the scrolling position for the contents of this notification should start at the bottom of the contents instead of the top when the contents are too long to display within the screen. Default is false (start scroll at the top).
| Parameters | |
|---|---|
startScrollBottom |
boolean |
| Returns | |
|---|---|
Notification.WearableExtender |
|
Interfaces
- ActionBar.OnMenuVisibilityListener
- ActionBar.OnNavigationListener
- ActionBar.TabListener
- AlarmManager.OnAlarmListener
- Application.ActivityLifecycleCallbacks
- Application.OnProvideAssistDataListener
- AppOpsManager.OnOpChangedListener
- DatePickerDialog.OnDateSetListener
- FragmentBreadCrumbs.OnBreadCrumbClickListener
- FragmentManager.BackStackEntry
- FragmentManager.OnBackStackChangedListener
- KeyguardManager.OnKeyguardExitResult
- LoaderManager.LoaderCallbacks
- Notification.Action.Extender
- Notification.Extender
- PendingIntent.OnFinished
- SearchManager.OnCancelListener
- SearchManager.OnDismissListener
- SharedElementCallback.OnSharedElementsReadyListener
- TimePickerDialog.OnTimeSetListener
- UiAutomation.AccessibilityEventFilter
- UiAutomation.OnAccessibilityEventListener
Classes
- ActionBar
- ActionBar.LayoutParams
- ActionBar.Tab
- Activity
- ActivityGroup
- ActivityManager
- ActivityManager.AppTask
- ActivityManager.MemoryInfo
- ActivityManager.ProcessErrorStateInfo
- ActivityManager.RecentTaskInfo
- ActivityManager.RunningAppProcessInfo
- ActivityManager.RunningServiceInfo
- ActivityManager.RunningTaskInfo
- ActivityManager.TaskDescription
- ActivityOptions
- AlarmManager
- AlarmManager.AlarmClockInfo
- AlertDialog
- AlertDialog.Builder
- AliasActivity
- Application
- ApplicationErrorReport
- ApplicationErrorReport.AnrInfo
- ApplicationErrorReport.BatteryInfo
- ApplicationErrorReport.CrashInfo
- ApplicationErrorReport.RunningServiceInfo
- AppOpsManager
- AutomaticZenRule
- DatePickerDialog
- Dialog
- DialogFragment
- DownloadManager
- DownloadManager.Query
- DownloadManager.Request
- ExpandableListActivity
- Fragment
- Fragment.SavedState
- FragmentBreadCrumbs
- FragmentContainer
- FragmentController
- FragmentHostCallback
- FragmentManager
- FragmentManager.FragmentLifecycleCallbacks
- FragmentManagerNonConfig
- FragmentTransaction
- Instrumentation
- Instrumentation.ActivityMonitor
- Instrumentation.ActivityResult
- IntentService
- KeyguardManager
- KeyguardManager.KeyguardDismissCallback
- KeyguardManager.KeyguardLock
- LauncherActivity
- LauncherActivity.IconResizer
- LauncherActivity.ListItem
- ListActivity
- ListFragment
- LoaderManager
- LocalActivityManager
- MediaRouteActionProvider
- MediaRouteButton
- NativeActivity
- Notification
- Notification.Action
- Notification.Action.Builder
- Notification.Action.WearableExtender
- Notification.BigPictureStyle
- Notification.BigTextStyle
- Notification.Builder
- Notification.CarExtender
- Notification.CarExtender.Builder
- Notification.CarExtender.UnreadConversation
- Notification.DecoratedCustomViewStyle
- Notification.DecoratedMediaCustomViewStyle
- Notification.InboxStyle
- Notification.MediaStyle
- Notification.MessagingStyle
- Notification.MessagingStyle.Message
- Notification.Style
- Notification.WearableExtender
- NotificationChannel
- NotificationChannelGroup
- NotificationManager
- NotificationManager.Policy
- PendingIntent
- PictureInPictureParams
- PictureInPictureParams.Builder
- Presentation
- ProgressDialog
- RemoteAction
- RemoteInput
- RemoteInput.Builder
- SearchableInfo
- SearchManager
- Service
- SharedElementCallback
- TabActivity
- TaskStackBuilder
- TimePickerDialog
- UiAutomation
- UiModeManager
- VoiceInteractor
- VoiceInteractor.AbortVoiceRequest
- VoiceInteractor.CommandRequest
- VoiceInteractor.CompleteVoiceRequest
- VoiceInteractor.ConfirmationRequest
- VoiceInteractor.PickOptionRequest
- VoiceInteractor.PickOptionRequest.Option
- VoiceInteractor.Prompt
- VoiceInteractor.Request
- WallpaperInfo
- WallpaperManager
Exceptions