Udostępnij za pośrednictwem


JobService.OnNetworkChanged(JobParameters) Method

Definition

This method is called that for a job that has a network constraint when the network to be used by the job changes.

[Android.Runtime.Register("onNetworkChanged", "(Landroid/app/job/JobParameters;)V", "GetOnNetworkChanged_Landroid_app_job_JobParameters_Handler", ApiSince=34)]
public virtual void OnNetworkChanged (Android.App.Job.JobParameters params);
[<Android.Runtime.Register("onNetworkChanged", "(Landroid/app/job/JobParameters;)V", "GetOnNetworkChanged_Landroid_app_job_JobParameters_Handler", ApiSince=34)>]
abstract member OnNetworkChanged : Android.App.Job.JobParameters -> unit
override this.OnNetworkChanged : Android.App.Job.JobParameters -> unit

Parameters

params
JobParameters

The parameters identifying this job, similar to what was supplied to the job in the #onStartJob(JobParameters) callback, but with an updated network.

Attributes

Remarks

This method is called that for a job that has a network constraint when the network to be used by the job changes. The new network object will be available via JobParameters#getNetwork(). Any network that results in this method call will match the job's requested network constraints.

For example, if a device is on a metered mobile network and then connects to an unmetered WiFi network, and the job has indicated that both networks satisfy its network constraint, then this method will be called to notify the job of the new unmetered WiFi network.

Java documentation for android.app.job.JobService.onNetworkChanged(android.app.job.JobParameters).

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