diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java index 7241596e..866d1f38 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java @@ -124,15 +124,20 @@ public class IITC_WebView extends WebView { } } - @TargetApi(16) + @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private boolean isConnectedToWifi() { ConnectivityManager conMan = (ConnectivityManager) getContext() .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI); + // since jelly bean you can mark wifi networks as mobile hotspots + // settings -> data usage -> menu -> mobile hotspots + // ConnectivityManager.isActiveNetworkMeter returns if the currently used wifi-network + // is ticked as mobile hotspot or not. + // --> IITC_WebView.isConnectedToWifi should return 'false' if connected to mobile hotspot if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - return wifi.getState() == NetworkInfo.State.CONNECTED && !conMan.isActiveNetworkMetered(); + return ((wifi.getState() == NetworkInfo.State.CONNECTED) && !conMan.isActiveNetworkMetered()); } - return wifi.getState() == NetworkInfo.State.CONNECTED; + return (wifi.getState() == NetworkInfo.State.CONNECTED); } public void disableJS(boolean val) {