OngoingActivity.Builder
public
static
final
class
OngoingActivity.Builder
extends Object
java.lang.Object | |
↳ | androidx.wear.ongoingactivity.OngoingActivity.Builder |
Builder used to build an OngoingActivity
Summary
Public constructors | |
---|---|
Builder(Context context, int notificationId, NotificationCompat.Builder notificationBuilder)
Construct a new empty |
Public methods | |
---|---|
OngoingActivity
|
build()
Combine all options provided and the information in the notification if needed,
return a new |
OngoingActivity.Builder
|
setAnimatedIcon(int animatedIcon)
Set the animated icon that can be used on some surfaces to represent this
|
OngoingActivity.Builder
|
setAnimatedIcon(Icon animatedIcon)
Set the animated icon that can be used on some surfaces to represent this
|
OngoingActivity.Builder
|
setCategory(String category)
Set the category of this |
OngoingActivity.Builder
|
setLocusId(LocusIdCompat locusId)
Set the corresponding LocusId of this |
OngoingActivity.Builder
|
setOngoingActivityId(int ongoingActivityId)
Give an id to this |
OngoingActivity.Builder
|
setStaticIcon(Icon staticIcon)
Set the animated icon that can be used on some surfaces to represent this
|
OngoingActivity.Builder
|
setStaticIcon(int staticIcon)
Set the animated icon that can be used on some surfaces to represent this
|
OngoingActivity.Builder
|
setStatus(OngoingActivityStatus status)
Set the initial status of this ongoing activity, the status may be displayed on the UI to show progress of the Ongoing Activity. |
OngoingActivity.Builder
|
setTouchIntent(PendingIntent touchIntent)
Set the intent to be used to go back to the activity when the user interacts with the Ongoing Activity in other surfaces (for example, taps the Icon on the WatchFace) |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (Context context, int notificationId, NotificationCompat.Builder notificationBuilder)
Construct a new empty OngoingActivity.Builder
, associated with the given notification.
Parameters | |
---|---|
context |
Context : to be used during the life of this OngoingActivity.Builder , will
NOT pass a reference into the built OngoingActivity |
notificationId |
int : id that will be used to post the notification associated
with this Ongoing Activity |
notificationBuilder |
NotificationCompat.Builder : builder for the notification associated with this Ongoing
Activity
|
Public methods
build
public OngoingActivity build ()
Combine all options provided and the information in the notification if needed,
return a new OngoingActivity
object.
Returns | |
---|---|
OngoingActivity |
Throws | |
---|---|
IllegalArgumentException |
if the static icon or the touch intent are not provided. |
setAnimatedIcon
public OngoingActivity.Builder setAnimatedIcon (int animatedIcon)
Set the animated icon that can be used on some surfaces to represent this
OngoingActivity
. For example, in the WatchFace.
Should be white with a transparent background, preferably an AnimatedVectorDrawable.
Parameters | |
---|---|
animatedIcon |
int |
Returns | |
---|---|
OngoingActivity.Builder |
setAnimatedIcon
public OngoingActivity.Builder setAnimatedIcon (Icon animatedIcon)
Set the animated icon that can be used on some surfaces to represent this
OngoingActivity
. For example, in the WatchFace.
Should be white with a transparent background, preferably an AnimatedVectorDrawable.
Parameters | |
---|---|
animatedIcon |
Icon |
Returns | |
---|---|
OngoingActivity.Builder |
setCategory
public OngoingActivity.Builder setCategory (String category)
Set the category of this OngoingActivity
, this may be used by the system to
prioritize it.
Parameters | |
---|---|
category |
String |
Returns | |
---|---|
OngoingActivity.Builder |
setLocusId
public OngoingActivity.Builder setLocusId (LocusIdCompat locusId)
Set the corresponding LocusId of this OngoingActivity
, this will be used by the
launcher to identify the corresponding launcher item and display it accordingly.
Parameters | |
---|---|
locusId |
LocusIdCompat |
Returns | |
---|---|
OngoingActivity.Builder |
setOngoingActivityId
public OngoingActivity.Builder setOngoingActivityId (int ongoingActivityId)
Give an id to this OngoingActivity
, as a way to reference it in
OngoingActivity.fromExistingOngoingActivity(Context, int)
Parameters | |
---|---|
ongoingActivityId |
int |
Returns | |
---|---|
OngoingActivity.Builder |
setStaticIcon
public OngoingActivity.Builder setStaticIcon (Icon staticIcon)
Set the animated icon that can be used on some surfaces to represent this
OngoingActivity
, for example in the WatchFace in ambient mode.
Should be white with a transparent background, preferably an VectorDrawable.
Parameters | |
---|---|
staticIcon |
Icon |
Returns | |
---|---|
OngoingActivity.Builder |
setStaticIcon
public OngoingActivity.Builder setStaticIcon (int staticIcon)
Set the animated icon that can be used on some surfaces to represent this
OngoingActivity
, for example in the WatchFace in ambient mode.
Should be white with a transparent background, preferably an VectorDrawable.
Parameters | |
---|---|
staticIcon |
int |
Returns | |
---|---|
OngoingActivity.Builder |
setStatus
public OngoingActivity.Builder setStatus (OngoingActivityStatus status)
Set the initial status of this ongoing activity, the status may be displayed on the UI to show progress of the Ongoing Activity.
Parameters | |
---|---|
status |
OngoingActivityStatus |
Returns | |
---|---|
OngoingActivity.Builder |
setTouchIntent
public OngoingActivity.Builder setTouchIntent (PendingIntent touchIntent)
Set the intent to be used to go back to the activity when the user interacts with the Ongoing Activity in other surfaces (for example, taps the Icon on the WatchFace)
Parameters | |
---|---|
touchIntent |
PendingIntent |
Returns | |
---|---|
OngoingActivity.Builder |