Is there a way to get notified when a VPN is connected or disconnected ? Due to what I see, ConnectivityManager does not convey any intentions about it.
I also tried (unsuccessfully) to register for the ACTION_VPN_CONNECTIVITY covert broadcast (as seen from the source code of android.net.vpn.VpnManager.java):
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 determine if a VPN is connected, in addition to periodically polling network interfaces, in order to detect the creation of a new network interface (usually ppp0)?
Regards, David
dbernard
source share