From c7baf0994a529e6a350faa7ec421c33b1def08f1 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sun, 12 Aug 2012 23:01:24 +0200 Subject: Accessing wifi state... (commented out, not as useful as I thought) --- src/de/blinkt/openvpn/NetworkSateReceiver.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/de') diff --git a/src/de/blinkt/openvpn/NetworkSateReceiver.java b/src/de/blinkt/openvpn/NetworkSateReceiver.java index a649bd65..6c38a0cb 100644 --- a/src/de/blinkt/openvpn/NetworkSateReceiver.java +++ b/src/de/blinkt/openvpn/NetworkSateReceiver.java @@ -6,7 +6,11 @@ import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; +import android.net.NetworkInfo.DetailedState; import android.net.NetworkInfo.State; +import android.net.wifi.SupplicantState; +import android.net.wifi.WifiInfo; +import android.net.wifi.WifiManager; import android.preference.PreferenceManager; public class NetworkSateReceiver extends BroadcastReceiver { @@ -37,10 +41,23 @@ public class NetworkSateReceiver extends BroadcastReceiver { if(extrainfo==null) extrainfo=""; + /* + if(networkInfo.getType()==android.net.ConnectivityManager.TYPE_WIFI) { + WifiManager wifiMgr = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + WifiInfo wifiinfo = wifiMgr.getConnectionInfo(); + extrainfo+=wifiinfo.getBSSID(); + + subtype += wifiinfo.getNetworkId(); + }*/ + + + netstatestring = String.format("%2$s %4$s to %1$s %3$s",networkInfo.getTypeName(), networkInfo.getDetailedState(),extrainfo,subtype ); } + + if(networkInfo!=null && networkInfo.getState() == State.CONNECTED) { int newnet = networkInfo.getType(); -- cgit v1.2.3