Public Methods

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

the action to add to this notification

Returns

this object for method chaining

See Also

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

the actions to add to this notification

Returns

this object for method chaining

See Also

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

the notification to add as another page

Returns

this object for method chaining

See Also

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.

Returns

See Also

Creates and returns a copy of this Object. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.

Returns

See Also

public
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.

See Also

public
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.

public
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

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.

Returns

public
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).

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

the pages for this notification

public
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).

Parameters

Returns

See Also

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

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.

See Also

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.

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.

Returns

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).

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).