OngoingActivityData
open class OngoingActivityData : VersionedParcelable
kotlin.Any | |
↳ | androidx.wear.ongoingactivity.OngoingActivityData |
This class is used internally by the library to represent the data of an OngoingActivity.
Summary
Public methods | |
---|---|
open static OngoingActivityData? |
create(@NonNull notification: Notification) Deserializes the |
open Icon? |
Get the animated icon that can be used on some surfaces to represent this |
open String? |
Get the Category of this |
open LocusIdCompat? |
Get the LocusId of this |
open Int |
Give the id to this |
open Icon |
Get the static icon that can be used on some surfaces to represent this |
open OngoingActivityStatus? |
Get the status of this ongoing activity, the status may be displayed on the UI to show progress of the Ongoing Activity. |
open Long |
Get the time (in |
open PendingIntent |
Get 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). |
open static Boolean |
hasOngoingActivity(@NonNull notification: Notification) Checks if the given notification represents an ongoing activity. |
Public methods
create
@Nullable open static fun create(@NonNull notification: Notification): OngoingActivityData?
Deserializes the OngoingActivityData
from a notification. Applies defaults from the notification for information not provided as part of the OngoingActivity
.
Parameters | |
---|---|
notification |
Notification: the notification that may contain information about a Ongoing Activity. |
Return | |
---|---|
OngoingActivityData? |
the data, or null of the notification doesn't contain Ongoing Activity data. |
getAnimatedIcon
@Nullable open fun getAnimatedIcon(): Icon?
Get the animated icon that can be used on some surfaces to represent this OngoingActivity
. For example, in the WatchFace.
getCategory
@Nullable open fun getCategory(): String?
Get the Category of this OngoingActivity
if set, otherwise the category of the corresponding notification.
getLocusId
@Nullable open fun getLocusId(): LocusIdCompat?
Get the LocusId of this OngoingActivity
, this can be used by the launcher to identify the corresponding launcher item and display it accordingly. If not set, returns the one in the corresponding Notification.
getOngoingActivityId
open fun getOngoingActivityId(): Int
Give the id to this OngoingActivity
, as a way to reference it in [fromExistingOngoingActivity]
getStaticIcon
@NonNull open fun getStaticIcon(): Icon
Get the static icon that can be used on some surfaces to represent this OngoingActivity
. For example in the WatchFace in ambient mode. If not set, returns the small icon of the corresponding Notification.
getStatus
@Nullable open fun getStatus(): OngoingActivityStatus?
Get the status of this ongoing activity, the status may be displayed on the UI to show progress of the Ongoing Activity. If not set, returns the content text of the corresponding Notification.
getTimestamp
open fun getTimestamp(): Long
Get the time (in SystemClock#elapsedRealtime()
time) the OngoingActivity was built.
getTouchIntent
@NonNull open fun getTouchIntent(): PendingIntent
Get 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). If not set, returns the touch intent of the corresponding Notification.
hasOngoingActivity
open static fun hasOngoingActivity(@NonNull notification: Notification): Boolean
Checks if the given notification represents an ongoing activity.