VpnService.ServiceMetaDataSupportsAlwaysOn Field
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.
Key for boolean meta-data field indicating whether this VpnService supports always-on mode.
[Android.Runtime.Register("SERVICE_META_DATA_SUPPORTS_ALWAYS_ON", ApiSince=27)]
public const string ServiceMetaDataSupportsAlwaysOn;
[<Android.Runtime.Register("SERVICE_META_DATA_SUPPORTS_ALWAYS_ON", ApiSince=27)>]
val mutable ServiceMetaDataSupportsAlwaysOn : string
Field Value
- Attributes
Remarks
Key for boolean meta-data field indicating whether this VpnService supports always-on mode.
For a VPN app targeting android.os.Build.VERSION_CODES#N API 24
or above, Android provides users with the ability to set it as always-on, so that VPN connection is persisted after device reboot and app upgrade. Always-on VPN can also be enabled by device owner and profile owner apps through DevicePolicyManager#setAlwaysOnVpnPackage
.
VPN apps not supporting this feature should opt out by adding this meta-data field to the VpnService
component of AndroidManifest.xml
. In case there is more than one VpnService
component defined in AndroidManifest.xml
, opting out any one of them will opt out the entire app. For example,
{@code
<service android:name=".ExampleVpnService"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="android.net.VpnService"/>
</intent-filter>
<meta-data android:name="android.net.VpnService.SUPPORTS_ALWAYS_ON"
android:value=false/>
</service>
}
This meta-data field defaults to true
if absent. It will only have effect on android.os.Build.VERSION_CODES#O_MR1
or higher.
Java documentation for android.net.VpnService.SERVICE_META_DATA_SUPPORTS_ALWAYS_ON
.
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.