ScheduleEventListener


@ExperimentalEventsApi
public interface ScheduleEventListener

Known direct subclasses
WorkMetricsInfoRepository

Repository class that calculates and stores metrics info and analytics about workers.


Listener interface that is called for events related to a worker's scheduling.

Summary

Public methods

default void

Called when a work request is canceled from the app e.g. WorkManager.cancelWorkById.

default void

Called when a work request is enqueued from the app e.g. WorkManager.enqueue.

default void

Called when a work request fails because a prerequisite work fails.

default void

Called when a work request is no longer waiting on any of its prerequisite work.

default void
onUpdated(@NonNull WorkInfo oldWorkInfo, @NonNull WorkInfo updatedWorkInfo)

Called when a work request is updated from the app e.g. WorkManager.updateWork.

Public methods

onCancelled

default void onCancelled(@NonNull WorkInfo workInfo)

Called when a work request is canceled from the app e.g. WorkManager.cancelWorkById.

Parameters
@NonNull WorkInfo workInfo

Snapshot of the work info

onEnqueued

default void onEnqueued(@NonNull WorkInfo workInfo)

Called when a work request is enqueued from the app e.g. WorkManager.enqueue.

Parameters
@NonNull WorkInfo workInfo

Snapshot of the work info

onPrerequisiteFailed

default void onPrerequisiteFailed(@NonNull WorkInfo workInfo)

Called when a work request fails because a prerequisite work fails.

Parameters
@NonNull WorkInfo workInfo

Snapshot of the work info

onUnblocked

default void onUnblocked(@NonNull WorkInfo workInfo)

Called when a work request is no longer waiting on any of its prerequisite work. If the work has no prerequisite work, this is called immediately after onEnqueued.

Parameters
@NonNull WorkInfo workInfo

Snapshot of the work info

onUpdated

default void onUpdated(@NonNull WorkInfo oldWorkInfo, @NonNull WorkInfo updatedWorkInfo)

Called when a work request is updated from the app e.g. WorkManager.updateWork.

Parameters
@NonNull WorkInfo oldWorkInfo

Snapshot of the work info before the update

@NonNull WorkInfo updatedWorkInfo

Snapshot of the work info after the update