Język

JobInfo.Builder.SetPriority(Int32) Method

Definition

Indicate the priority for this job.

[Android.Runtime.Register("setPriority", "(I)Landroid/app/job/JobInfo$Builder;", "", ApiSince=33)]
public Android.App.Job.JobInfo.Builder SetPriority(int priority);
[<Android.Runtime.Register("setPriority", "(I)Landroid/app/job/JobInfo$Builder;", "", ApiSince=33)>]
member this.SetPriority : int -> Android.App.Job.JobInfo.Builder

Parameters

priority
Int32

Value is one of the following: JobInfo.PRIORITY_MIN; JobInfo.PRIORITY_LOW; JobInfo.PRIORITY_DEFAULT; JobInfo.PRIORITY_HIGH; JobInfo.PRIORITY_MAX

Returns

This builder instance.

Attributes

Remarks

Indicate the priority for this job. The priority set here will be used to sort jobs for the calling app and apply slightly different policies based on the priority. The priority will NOT be used as a global sorting value to sort between different app's jobs. Use this to inform the system about which jobs it should try to run before other jobs. Giving the same priority to all of your jobs will result in them all being treated the same. The priorities each have slightly different behaviors, as noted in their relevant javadoc. Starting in Android version Build.VERSION_CODES.UPSIDE_DOWN_CAKE, the priority will only affect sorting order within the job's namespace. NOTE: Setting all of your jobs to high priority will not be beneficial to your app and in fact may hurt its performance in the long run. In order to prevent starvation, repeatedly retried jobs (because of failures) will slowly have their priorities lowered.

Android reference for android.app.job.JobInfo.Builder.setPriority.

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