Stay organized with collections
Save and categorize content based on your preferences.
abstract class PlatformVpnProfile
Known Direct Subclasses
Ikev2VpnProfile |
The Ikev2VpnProfile is a configuration for the platform setup of IKEv2/IPsec VPNs.
|
|
PlatformVpnProfile represents a configuration for a platform-based VPN implementation.
Platform-based VPNs allow VPN applications to provide configuration and authentication options to leverage the Android OS' implementations of well-defined control plane (authentication, key negotiation) and data plane (per-packet encryption) protocols to simplify the creation of VPN tunnels. In contrast, VpnService
based VPNs must implement both the control and data planes on a per-app basis.
Summary
Public methods |
Boolean |
Returns whether the local traffic is exempted from the VPN.
|
Int |
Returns the profile integer type.
|
String |
Returns a type string describing the VPN profile type
|
Boolean |
Returns whether this VPN should undergo Internet validation.
|
Constants
TYPE_IKEV2_IPSEC_PSK
static val TYPE_IKEV2_IPSEC_PSK: Int
Value: 7
TYPE_IKEV2_IPSEC_RSA
static val TYPE_IKEV2_IPSEC_RSA: Int
Value: 8
TYPE_IKEV2_IPSEC_USER_PASS
static val TYPE_IKEV2_IPSEC_USER_PASS: Int
Value: 6
Public methods
areLocalRoutesExcluded
fun areLocalRoutesExcluded(): Boolean
Returns whether the local traffic is exempted from the VPN.
getType
fun getType(): Int
Returns the profile integer type.
getTypeString
fun getTypeString(): String
Returns a type string describing the VPN profile type
Return |
String |
This value cannot be null . |
isInternetValidationRequired
fun isInternetValidationRequired(): Boolean
Returns whether this VPN should undergo Internet validation. If this is true, the platform will perform basic validation checks for Internet connectivity over this VPN. If and when they succeed, the VPN network capabilities will reflect this by gaining the NetworkCapabilities.NET_CAPABILITY_VALIDATED
capability. If this is false, the platform assumes the VPN either is always capable of reaching the Internet or intends not to. In this case, the VPN network capabilities will always gain the NetworkCapabilities.NET_CAPABILITY_VALIDATED
capability immediately after it connects, whether it can reach public Internet destinations or not.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PlatformVpnProfile\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPlatformVpnProfile\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/PlatformVpnProfile \"View this page in Java\") \n\n```\nabstract class PlatformVpnProfile\n```\n\n|---|-------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.PlatformVpnProfile](#) |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [Ikev2VpnProfile](/reference/kotlin/android/net/Ikev2VpnProfile) |------------------------------------------------------------------|------------------------------------------------------------------------------------| | [Ikev2VpnProfile](/reference/kotlin/android/net/Ikev2VpnProfile) | The Ikev2VpnProfile is a configuration for the platform setup of IKEv2/IPsec VPNs. | |\n\nPlatformVpnProfile represents a configuration for a platform-based VPN implementation.\n\nPlatform-based VPNs allow VPN applications to provide configuration and authentication options to leverage the Android OS' implementations of well-defined control plane (authentication, key negotiation) and data plane (per-packet encryption) protocols to simplify the creation of VPN tunnels. In contrast, [VpnService](/reference/kotlin/android/net/VpnService) based VPNs must implement both the control and data planes on a per-app basis.\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [TYPE_IKEV2_IPSEC_PSK](#TYPE_IKEV2_IPSEC_PSK:kotlin.Int) \u003cbr /\u003e |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [TYPE_IKEV2_IPSEC_RSA](#TYPE_IKEV2_IPSEC_RSA:kotlin.Int) \u003cbr /\u003e |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [TYPE_IKEV2_IPSEC_USER_PASS](#TYPE_IKEV2_IPSEC_USER_PASS:kotlin.Int) \u003cbr /\u003e |\n\n| Public methods ||\n|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [areLocalRoutesExcluded](#areLocalRoutesExcluded())`()` Returns whether the local traffic is exempted from the VPN. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getType](#getType())`()` Returns the profile integer type. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getTypeString](#getTypeString())`()` Returns a type string describing the VPN profile type |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isInternetValidationRequired](#isInternetValidationRequired())`()` Returns whether this VPN should undergo Internet validation. |\n\nConstants\n---------\n\n### TYPE_IKEV2_IPSEC_PSK\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val TYPE_IKEV2_IPSEC_PSK: Int\n``` \n\n Value: 7\n\n### TYPE_IKEV2_IPSEC_RSA\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val TYPE_IKEV2_IPSEC_RSA: Int\n``` \n\n Value: 8\n\n### TYPE_IKEV2_IPSEC_USER_PASS\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val TYPE_IKEV2_IPSEC_USER_PASS: Int\n``` \n\n Value: 6\n\nPublic methods\n--------------\n\n### areLocalRoutesExcluded\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun areLocalRoutesExcluded(): Boolean\n```\n\nReturns whether the local traffic is exempted from the VPN. \n\n### getType\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getType(): Int\n```\n\nReturns the profile integer type.\n\n| Return ||\n|----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is [android.net.PlatformVpnProfile#TYPE_IKEV2_IPSEC_USER_PASS](#TYPE_IKEV2_IPSEC_USER_PASS:kotlin.Int), [android.net.PlatformVpnProfile#TYPE_IKEV2_IPSEC_PSK](#TYPE_IKEV2_IPSEC_PSK:kotlin.Int), or [android.net.PlatformVpnProfile#TYPE_IKEV2_IPSEC_RSA](#TYPE_IKEV2_IPSEC_RSA:kotlin.Int) |\n\n### getTypeString\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getTypeString(): String\n```\n\nReturns a type string describing the VPN profile type\n\n| Return ||\n|----------------------------------------------------------------------------------|------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | This value cannot be `null`. |\n\n### isInternetValidationRequired\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun isInternetValidationRequired(): Boolean\n```\n\nReturns whether this VPN should undergo Internet validation. If this is true, the platform will perform basic validation checks for Internet connectivity over this VPN. If and when they succeed, the VPN network capabilities will reflect this by gaining the [NetworkCapabilities.NET_CAPABILITY_VALIDATED](/reference/kotlin/android/net/NetworkCapabilities#NET_CAPABILITY_VALIDATED:kotlin.Int) capability. If this is false, the platform assumes the VPN either is always capable of reaching the Internet or intends not to. In this case, the VPN network capabilities will always gain the [NetworkCapabilities.NET_CAPABILITY_VALIDATED](/reference/kotlin/android/net/NetworkCapabilities#NET_CAPABILITY_VALIDATED:kotlin.Int) capability immediately after it connects, whether it can reach public Internet destinations or not."]]