diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-08-12 23:01:24 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-08-12 23:01:24 +0200 |
commit | c7baf0994a529e6a350faa7ec421c33b1def08f1 (patch) | |
tree | 1992749354015407e6c4e00eddee10cd78204ee4 | |
parent | 04224f3c2d7d18ce420f686abea1d6981a0946c2 (diff) |
Accessing wifi state... (commented out, not as useful as I thought)
-rw-r--r-- | AndroidManifest.xml | 1 | ||||
-rw-r--r-- | build-native.bat | 3 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/NetworkSateReceiver.java | 17 |
3 files changed, 20 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ad16b0ad..d1339ee0 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -22,6 +22,7 @@ <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + <!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> --> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> diff --git a/build-native.bat b/build-native.bat index 73fc94b9..2c6303ea 100644 --- a/build-native.bat +++ b/build-native.bat @@ -1,5 +1,6 @@ @echo on
-ndk-build -j 8
+call ndk-build -j 8
+
cd libs
mkdir ..\assets 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();
|