Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check VPN connection status on Android ICS

I'm trying to register receiver, that will check VPN status. I have tried this: Get VPN Connection status on Android but looks like it no longer works on ICS. I have checked android source code for some clue, but with no luck, only noticed that in ISC there is nothing like: vpn.connectivity and connection_state - it use to be in android 2.3. Also tried using android.net.conn.CONNECTIVITY_CHANGE as my IntentFilter, but it doesn't react on VPN connection at all (of course I have added permission android.permission.ACCESS_NETWORK_STATE). I thought that it is simple thing to do, but I already run out of ideas how to do it... Could someone help me with this please?

like image 467
Stigi Avatar asked Jun 01 '12 13:06

Stigi


1 Answers

May be you can try to poll for DNS server changes. If it has changed then VPN has connected. However, I think there could be a lot of exception to this rule.

How do you get the current DNS servers for Android?

like image 164
Victor Ronin Avatar answered Nov 04 '22 03:11

Victor Ronin