vpnIsEnabled

suspend fun vpnIsEnabled(): Boolean

Determine if a Virtual Private Network (VPN) is enabled.


🔑 Minimum required license level: Core.


Sample usage

try {
val networkDiagnostic = rasp.diagnostic.network
val vpnIsEnabled = networkDiagnostic.vpnIsEnabled()
Log.d("RASP-DEMO", "[networkDiagnostic] vpnIsEnabled: $vpnIsEnabled")
} catch (e: Exception) {
Log.e("RASP-DEMO", "[networkDiagnostic] vpnIsEnabled error: ${e.message}")
}


To observe changes of the VPN check you can use the observe() method.

val modelNetwork = rasp.watcher.network.observe()
launch {
networkModel.vpnIsEnabled.collect { detected ->
if (detected != null && detected) {
Log.d("RASP-DEMO", "[vpnIsEnabled] $detected")
}
}

Return

Boolean — true if VPN is currently detected.