- All Implemented Interfaces:
JobScheduler. To use this scheduler, you must add
PlatformScheduler.PlatformSchedulerServiceto your manifest:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <service android:name="com.google.android.exoplayer2.scheduler.PlatformScheduler$PlatformSchedulerService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true"/>
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
cancel()Cancels anything that was previously scheduled, or else does nothing.
schedule(Requirements requirements, String servicePackage, String serviceAction)Schedules a service to be started in the foreground when some
@RequiresPermission("android.permission.RECEIVE_BOOT_COMPLETED") public PlatformScheduler(Context context, int jobId)
public boolean schedule(Requirements requirements, String servicePackage, String serviceAction)Schedules a service to be started in the foreground when some
Requirementsare met. Anything that was previously scheduled will be canceled.
The service to be started must be declared in the manifest of
servicePackagewith 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
public boolean cancel()Cancels anything that was previously scheduled, or else does nothing.
public Requirements getSupportedRequirements(Requirements requirements)Checks whether this
Schedulersupports the provided
Requirements. If all of the requirements are supported then the same
Requirementsinstance is returned. If not then a new instance is returned containing the subset of the requirements that are supported.