Share via


JobParameters.Network Property

Definition

Return the network that should be used to perform any network requests for this job.

public virtual Android.Net.Network? Network { [Android.Runtime.Register("getNetwork", "()Landroid/net/Network;", "GetGetNetworkHandler", ApiSince=28)] get; }
[<get: Android.Runtime.Register("getNetwork", "()Landroid/net/Network;", "GetGetNetworkHandler", ApiSince=28)>]
member this.Network : Android.Net.Network

Property Value

the network that should be used to perform any network requests for this job, or null if this job didn't set any required network type or if the job executed when there was no available network to use.

Attributes

Remarks

Return the network that should be used to perform any network requests for this job.

Devices may have multiple active network connections simultaneously, or they may not have a default network route at all. To correctly handle all situations like this, your job should always use the network returned by this method instead of implicitly using the default network route.

Note that the system may relax the constraints you originally requested, such as allowing a JobInfo#NETWORK_TYPE_UNMETERED job to run over a metered network when there is a surplus of metered data available.

Starting in Android version android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, this will return null if the app does not hold the permissions specified in JobInfo.Builder#setRequiredNetwork(NetworkRequest).

Java documentation for android.app.job.JobParameters.getNetwork().

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