VpnService.Prepare(Context) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Prepare to establish a VPN connection.
[Android.Runtime.Register("prepare", "(Landroid/content/Context;)Landroid/content/Intent;", "")]
public static Android.Content.Intent? Prepare (Android.Content.Context? context);
[<Android.Runtime.Register("prepare", "(Landroid/content/Context;)Landroid/content/Intent;", "")>]
static member Prepare : Android.Content.Context -> Android.Content.Intent
Parameters
- context
- Context
Returns
- Attributes
Remarks
Prepare to establish a VPN connection. This method returns null
if the VPN application is already prepared or if the user has previously consented to the VPN application. Otherwise, it returns an Intent
to a system activity. The application should launch the activity using Activity#startActivityForResult
to get itself prepared. 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 application becomes prepared and is granted to use other methods in this class.
Only one application can be granted at the same time. The right is revoked when another application is granted. The application losing the right will be notified via its #onRevoke
. Unless it becomes prepared again, subsequent calls to other methods in this class will fail.
The user may disable the VPN at any time while it is activated, in which case this method will return an intent the next time it is executed to obtain the user's consent again.
Java documentation for android.net.VpnService.prepare(android.content.Context)
.
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.