Interface Scheduler

  • All Known Implementing Classes:
    PlatformScheduler, WorkManagerScheduler

    public interface Scheduler
    Deprecated. 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.
    Schedules a service to be started in the foreground when some Requirements are met.
    • Method Detail

      • schedule

        boolean schedule​(Requirements requirements,
                         String servicePackage,
                         String serviceAction)
        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).

        requirements - The requirements.
        servicePackage - The package name.
        serviceAction - The action with which the service will be started.
        Whether scheduling was successful.
      • cancel

        boolean cancel()
        Cancels anything that was previously scheduled, or else does nothing.
        Whether cancellation was successful.
      • getSupportedRequirements

        Requirements getSupportedRequirements​(Requirements requirements)
        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.
        requirements - The requirements to check.
        The supported requirements.