共用方式為


UserManager.DisallowConfigVpn Field

Definition

Specifies if a user is disallowed from configuring a VPN.

[Android.Runtime.Register("DISALLOW_CONFIG_VPN")]
public const string DisallowConfigVpn;
[<Android.Runtime.Register("DISALLOW_CONFIG_VPN")>]
val mutable DisallowConfigVpn : string

Field Value

Attributes

Remarks

Specifies if a user is disallowed from configuring a VPN. The default value is false. This restriction has an effect when set by device owners and, in Android 6.0 (android.os.Build.VERSION_CODES#M API level 23) or higher, profile owners.

This restriction also prevents VPNs from starting. However, in Android 7.0 (android.os.Build.VERSION_CODES#N API level 24) or higher, the system does start always-on VPNs created by the device or profile owner.

From Android 12 (android.os.Build.VERSION_CODES#S API level 31) enforcing this restriction clears currently active VPN if it was configured by the user.

Holders of the permission android.Manifest.permission#MANAGE_DEVICE_POLICY_VPN can set this restriction using the DevicePolicyManager APIs mentioned below.

Key for user restrictions.

Type: Boolean

Java documentation for android.os.UserManager.DISALLOW_CONFIG_VPN.

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

See also