# Print output for @column tags ?>
public
class
VpnManager
extends Object
java.lang.Object | |
↳ | android.net.VpnManager |
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 maintainance burden. This also give the user
the guarantee that VPN network traffic is not subjected to on-device packet interception.
See also:
Public methods | |
---|---|
void
|
deleteProvisionedVpnProfile()
Delete the VPN profile configuration that was provisioned by the calling app |
Intent
|
provisionVpnProfile(PlatformVpnProfile profile)
Install a VpnProfile configuration keyed on the calling app's package name. |
void
|
startProvisionedVpnProfile()
Request the startup of a previously provisioned VPN. |
void
|
stopProvisionedVpnProfile()
Tear down the VPN provided by the calling app (if any) |
Inherited methods | |
---|---|
public void deleteProvisionedVpnProfile ()
Delete the VPN profile configuration that was provisioned by the calling app
Throws | |
---|---|
SecurityException |
if this would violate user settings |
public Intent provisionVpnProfile (PlatformVpnProfile profile)
Install a VpnProfile configuration keyed on the calling app's package name.
This method returns null
if user consent has already been granted, or an Intent
to a system activity. If an intent is returned, the application should launch the
activity using Activity#startActivityForResult
to request user consent. The activity
may pop up a dialog to require user action, and the result will come back via its Activity#onActivityResult
. If the result is Activity#RESULT_OK
, the user has
consented, and the VPN profile can be started.
Parameters | |
---|---|
profile |
PlatformVpnProfile : the VpnProfile provided by this package. Will override any previous VpnProfile
stored for this package.
This value cannot be null . |
Returns | |
---|---|
Intent |
an Intent requesting user consent to start the VPN, or null if consent is not required based on privileges or previous user consent. |
public void startProvisionedVpnProfile ()
Request the startup of a previously provisioned VPN.
Throws | |
---|---|
SecurityException |
exception if user or device settings prevent this VPN from being setup, or if user consent has not been granted |
public void stopProvisionedVpnProfile ()
Tear down the VPN provided by the calling app (if any)