java.lang.Object | |
↳ | android.preview.support.wearable.notifications.WearableNotifications.Builder |
Builder class that wraps a NotificationCompat.Builder
to add
wearable extensions for a notification.
You can chain the "set" methods for this builder in any order,
but you must call the build()
method last to build the final notification.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a builder to be used for adding wearable extensions to notifications.
| |||||||||||
Construct a builder to be used for adding wearable extensions to notifications to
a
NotificationCompat.Builder . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add an action to this notification.
| |||||||||||
Add an additional page of content to display with this notification.
| |||||||||||
Add additional pages of content to display with this notification.
| |||||||||||
Adds a
RemoteInput for the content intent. | |||||||||||
Combine all of the options that have been set by both this builder and
the wrapped
NotificationCompat.Builder object and return a new
Notification object. | |||||||||||
Return the
NotificationCompat.Builder being wrapped by this object. | |||||||||||
Get the current metadata Bundle used by this Builder, creating a new one
as necessary.
| |||||||||||
Add a big action display to this notification.
| |||||||||||
Add a big action display to this notification.
| |||||||||||
Set this notification to be part of a group of notifications sharing the same key.
| |||||||||||
Set this notification to be part of a group of notifications sharing the same key.
| |||||||||||
Set a hint that this notification's icon should not be displayed.
| |||||||||||
Set whether or not this notification is only relevant to the current device.
| |||||||||||
Set the priority of this notification to be minimum priority level
(
PRIORITY_MIN ). |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Construct a builder to be used for adding wearable extensions to notifications. Both the
wrapped builder (accessible via getCompatBuilder()
) and this builder can be used
simultaneously, but the build() method from this object must be called in the end.
Always post notifications to the notification
system with the NotificationManagerCompat.notify(...)
methods
instead of the NotificationManager.notify(...)
methods.
WearableNotifications.Builder builder = new WearableNotifications.Builder(mContext) .setLocalOnly(true); builder.getCompatBuilder() .setContentTitle("New mail from " + sender.toString()) .setContentText(subject) .setSmallIcon(R.drawable.new_mail); Notification notif = builder.build(); NotificationManagerCompat.from(mContext).notify(0, notif);
Construct a builder to be used for adding wearable extensions to notifications to
a NotificationCompat.Builder
. Both the wrapped builder and this
builder can be used simultaneously, but the build() method from this object must be
called in the end.
Always post notifications to the notification
system with the NotificationManagerCompat.notify(...)
methods
instead of the NotificationManager.notify(...)
methods.
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext) .setContentTitle("New mail from " + sender.toString()) .setContentText(subject) .setSmallIcon(R.drawable.new_mail); Notification notif = new WearableNotifications.Builder(builder) .setLocalOnly(true) .build(); NotificationManagerCompat.from(mContext).notify(0, notif);
Add an action to this notification. Actions are typically displayed by
the system as a button adjacent to the notification content. This method
accepts WearableNotifications.Action
extension wrappers. Actions added by this function
are appended when build()
is called.
action | the action to add to this notification |
---|
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.
page | the notification to add as another page |
---|
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.
pages | a collection of notifications |
---|
Adds a RemoteInput
for the content intent. The collected
data will be overlayed onto the content intent.
input | a RemoteInput object to obtain a user response |
---|
Combine all of the options that have been set by both this builder and
the wrapped NotificationCompat.Builder
object and return a new
Notification
object.
Return the NotificationCompat.Builder
being wrapped by this object.
NotificationCompat.Builder
Get the current metadata Bundle used by this Builder, creating a new one as necessary.
The returned Bundle is shared with this Builder.
Add a big action display to this notification. Big actions show a hint to users about the action taken when the content intent is triggered.
icon | icon to display for the content action. |
---|---|
subtext | Optional subtext to display with the big action icon. |
Add a big action display to this notification. Big actions show a hint to users about the action taken when the content intent is triggered.
icon | icon to display for the content action. |
---|
Set this notification to be part of a group of notifications sharing the same key. Grouped notifications may display in a cluster or stack on devices which support such rendering.
groupKey | The group key of the group. Unique within a package. |
---|---|
groupOrder | The 0-indexed sort order within the group. Can also be set
to the sentinel value GROUP_ORDER_SUMMARY to mark this
notification as being the group summary. |
Set this notification to be part of a group of notifications sharing the same key. Grouped notifications may display in a cluster or stack on devices which support such rendering. Use the default ordering within a group.
groupKey | The group key of the group. Unique within a package. |
---|
Set a hint that this notification's icon should not be displayed.
hintHideIcon | true to hide the icon, false otherwise. |
---|
Set whether or not this notification is only relevant to the current device.
Some notifications can be bridged to other devices for remote display. This hint can be set to recommend this notification not be bridged.
localOnly | true to keep the notification on this device,
false otherwise. Default value is false . |
---|
Set the priority of this notification to be minimum priority level
(PRIORITY_MIN
). When set via WearableNotifications, these
minimum priority notifications will bypass the notification manager on platforms
that do not support ambient level notifications.