Partager via


VpnManager Class

Definition

This class provides an interface for apps to manage platform VPN profiles

[Android.Runtime.Register("android/net/VpnManager", ApiSince=30, DoNotGenerateAcw=true)]
public class VpnManager : Java.Lang.Object
[<Android.Runtime.Register("android/net/VpnManager", ApiSince=30, DoNotGenerateAcw=true)>]
type VpnManager = class
    inherit Object
Inheritance
VpnManager
Attributes

Remarks

This class provides an interface for apps to manage platform VPN profiles

Apps can use this API to provide profiles with which the platform can set up a VPN without further app intermediation. When a VPN profile is present and the app is selected as an always-on VPN, the platform will directly trigger the negotiation of the VPN without starting or waking the app (unlike VpnService).

VPN apps using supported protocols should preferentially use this API over the VpnService API for ease-of-development and reduced maintenance burden. This also give the user the guarantee that VPN network traffic is not subjected to on-device packet interception.

Java documentation for android.net.VpnManager.

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.

Constructors

VpnManager(IntPtr, JniHandleOwnership)

Fields

ActionVpnManagerEvent

Action sent in android.content.Intents to VpnManager clients when an event occurred.

CategoryEventAlwaysOnStateChanged

The always-on state of this VPN was changed

CategoryEventDeactivatedByUser

The user deactivated the VPN.

CategoryEventIkeError

An IKE protocol error occurred.

CategoryEventNetworkError

A network error occurred.

ErrorClassNotRecoverable
Obsolete.

#EXTRA_ERROR_CLASS coding for a non-recoverable error.

ErrorClassRecoverable
Obsolete.

#EXTRA_ERROR_CLASS coding for a recoverable error.

ErrorCodeNetworkIo
Obsolete.

An #EXTRA_ERROR_CODE for #CATEGORY_EVENT_NETWORK_ERROR indicating an input/output error.

ErrorCodeNetworkLost
Obsolete.

An #EXTRA_ERROR_CODE for #CATEGORY_EVENT_NETWORK_ERROR indicating that network connectivity was lost.

ErrorCodeNetworkProtocolTimeout
Obsolete.

An #EXTRA_ERROR_CODE for #CATEGORY_EVENT_NETWORK_ERROR indicating a timeout.

ErrorCodeNetworkUnknownHost
Obsolete.

An #EXTRA_ERROR_CODE for #CATEGORY_EVENT_NETWORK_ERROR to indicate that the network host isn't known.

ExtraErrorClass

Extra for the error class, as an int.

ExtraErrorCode

Extra for an error code, as an int.

ExtraSessionKey

The key of the session that experienced this event, as a String.

ExtraTimestampMillis

A long timestamp containing the time at which the event occurred.

ExtraUnderlyingLinkProperties

The LinkProperties of the underlying network when the event occurred.

ExtraUnderlyingNetwork

The network that was underlying the VPN when the event occurred, as a Network.

ExtraUnderlyingNetworkCapabilities

The NetworkCapabilities of the underlying network when the event occurred.

ExtraVpnProfileState

The VpnProfileState at the time that this event occurred.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ProvisionedVpnProfileState

Retrieve the VpnProfileState for the profile provisioned by the calling package.

ThresholdClass
ThresholdType

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DeleteProvisionedVpnProfile()

Delete the VPN profile configuration that was provisioned by the calling app

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ProvisionVpnProfile(PlatformVpnProfile)

Install a VpnProfile configuration keyed on the calling app's package name.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
StartProvisionedVpnProfile()

Request the startup of a previously provisioned VPN.

StartProvisionedVpnProfileSession()

Request the startup of a previously provisioned VPN.

StopProvisionedVpnProfile()

Tear down the VPN provided by the calling app (if any)

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to