Is there a way to get notified when a VPN is connected or disconnected? Because of what I see, the ConnectivityManager does not broadcast any intent about that.
I also tried (unsuccessfully) to register to the hidden ACTION_VPN_CONNECTIVITY broadcast (as seen in android.net.vpn.VpnManager.java source code):
context.registerReceiver(new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { android.util.Log.d("MyApp", "Received VPN broadcast."); } }, new IntentFilter("vpn.connectivity")); // VpnManager.ACTION_VPN_CONNECTIVITY
So is there a way to detect if a VPN is connected, beside polling the networks interfaces periodically to detect the creation of a new network interface (usually ppp0)?
Best regards, David