public final class

OngoingActivity.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.wear.ongoingactivity.OngoingActivity.Builder

Overview

Builder used to build an OngoingActivity

Summary

Constructors
publicBuilder(Context context, int notificationId, NotificationCompat.Builder notificationBuilder)

Construct a new empty OngoingActivity.Builder, associated with the given notification.

Methods
public OngoingActivitybuild()

Combine all options provided and the information in the notification if needed, return a new OngoingActivity object.

public OngoingActivity.BuildersetAnimatedIcon(Icon animatedIcon)

Set the animated icon that can be used on some surfaces to represent this OngoingActivity.

public OngoingActivity.BuildersetLocusId(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.

public OngoingActivity.BuildersetOngoingActivityId(int ongoingActivityId)

Give an id to this OngoingActivity, as a way to reference it in OngoingActivity.fromExistingOngoingActivity(Context, int)

public OngoingActivity.BuildersetStaticIcon(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.

public OngoingActivity.BuildersetStatus(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.

public OngoingActivity.BuildersetTouchIntent(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)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(Context context, int notificationId, NotificationCompat.Builder notificationBuilder)

Construct a new empty OngoingActivity.Builder, associated with the given notification.

Parameters:

context: to be used during the life of this OngoingActivity.Builder, will NOT pass a reference into the built OngoingActivity
notificationId: id that will be used to post the notification associated with this Ongoing Activity
notificationBuilder: builder for the notification associated with this Ongoing Activity

Methods

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.

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.

Set the initial status of this ongoing activity, the status may be displayed on the UI to show progress of the Ongoing Activity.

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)

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.

public OngoingActivity.Builder setOngoingActivityId(int ongoingActivityId)

Give an id to this OngoingActivity, as a way to reference it in OngoingActivity.fromExistingOngoingActivity(Context, int)

public OngoingActivity build()

Combine all options provided and the information in the notification if needed, return a new OngoingActivity object.