VPN condition?
Posted: 13 Apr 2019 08:05
Does anyone know of a way to test if a VPN is running?
Code: Select all
ctx=getContext();
cm=callJavaMethod(ctx, "android.content.Context", "getSystemService(java.lang.String)", "connectivity");
vpnconnected=callJavaMethod(callJavaMethod(cm, "android.net.ConnectivityManager", "getNetworkInfo(int)", getJavaStaticField("android.net.ConnectivityManager", "TYPE_VPN")), "android.net.NetworkInfo", "isConnectedOrConnecting()");