Sdílet prostřednictvím


JobScheduler.Schedule(JobInfo) Method

Definition

Schedule a job to be executed.

[Android.Runtime.Register("schedule", "(Landroid/app/job/JobInfo;)I", "GetSchedule_Landroid_app_job_JobInfo_Handler")]
public abstract int Schedule (Android.App.Job.JobInfo job);
[<Android.Runtime.Register("schedule", "(Landroid/app/job/JobInfo;)I", "GetSchedule_Landroid_app_job_JobInfo_Handler")>]
abstract member Schedule : Android.App.Job.JobInfo -> int

Parameters

job
JobInfo

The job you wish scheduled. See android.app.job.JobInfo.Builder JobInfo.Builder for more detail on the sorts of jobs you can schedule.

Returns

the result of the schedule request.

Attributes

Remarks

Schedule a job to be executed. Will replace any currently scheduled job with the same ID with the new information in the JobInfo. If a job with the given ID is currently running, it will be stopped.

<p class="caution"><strong>Note:</strong> Scheduling a job can have a high cost, even if it's rescheduling the same job and the job didn't execute, especially on platform versions before version android.os.Build.VERSION_CODES#Q. As such, the system may throttle calls to this API if calls are made too frequently in a short amount of time.

Note: The JobService component needs to be enabled in order to successfully schedule a job.

Java documentation for android.app.job.JobScheduler.schedule(android.app.job.JobInfo).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to