Back to Exoplayer

WorkManagerScheduler (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/ext/workmanager/WorkManagerScheduler.html

latest6.4 KB
Original Source

Package com.google.android.exoplayer2.ext.workmanager

Class WorkManagerScheduler

  • java.lang.Object

    • com.google.android.exoplayer2.ext.workmanager.WorkManagerScheduler
  • All Implemented Interfaces:Scheduler


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classWorkManagerSchedulerextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Scheduler](../../scheduler/Scheduler.html "interface in com.google.android.exoplayer2.scheduler")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

A Scheduler that uses WorkManager.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static class | WorkManagerScheduler.SchedulerWorker | Deprecated.

A Worker that starts the target service if the requirements are met. |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | WorkManagerScheduler​(Context context, String workName) | Deprecated. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | boolean | cancel() | Deprecated.

Cancels anything that was previously scheduled, or else does nothing. | | Requirements | getSupportedRequirements​(Requirements requirements) | Deprecated.

Checks whether this Scheduler supports the provided Requirements. | | boolean | schedule​(Requirements requirements, String servicePackage, String serviceAction) | Deprecated.

Schedules a service to be started in the foreground when some Requirements are met. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

WorkManagerScheduler

public WorkManagerScheduler​([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")workName)

Deprecated. Parameters:context - A context.workName - A name for work scheduled by this instance. If the same name was used by a previous instance, anything scheduled by the previous instance will be canceled by this instance if schedule(Requirements, String, String) or cancel() are called.

Method Detail

- 

schedule

public boolean schedule​([Requirements](../../scheduler/Requirements.html "class in com.google.android.exoplayer2.scheduler")requirements,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")servicePackage,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")serviceAction)

Deprecated.

Description copied from interface: Scheduler

Schedules a service to be started in the foreground when some Requirements are met. Anything that was previously scheduled will be canceled.

The service to be started must be declared in the manifest of servicePackage with an intent filter containing serviceAction. Note that when started with serviceAction, the service must call Service.startForeground(int, Notification) to make itself a foreground service, as documented by ContextWrapper.startForegroundService(Intent).

Specified by:schedule in interface SchedulerParameters:requirements - The requirements.servicePackage - The package name.serviceAction - The action with which the service will be started.Returns:Whether scheduling was successful.

- 

cancel

public boolean cancel()

Deprecated.

Description copied from interface: Scheduler

Cancels anything that was previously scheduled, or else does nothing. Specified by:cancel in interface SchedulerReturns:Whether cancellation was successful.

- 

getSupportedRequirements

public[Requirements](../../scheduler/Requirements.html "class in com.google.android.exoplayer2.scheduler")getSupportedRequirements​([Requirements](../../scheduler/Requirements.html "class in com.google.android.exoplayer2.scheduler")requirements)

Deprecated.

Description copied from interface: Scheduler

Checks whether this Scheduler supports the provided Requirements. If all of the requirements are supported then the same Requirements instance is returned. If not then a new instance is returned containing the subset of the requirements that are supported. Specified by:getSupportedRequirements in interface SchedulerParameters:requirements - The requirements to check.Returns:The supported requirements.