--- android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java 2011/10/20 18:39:19 1616 +++ android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java 2011/10/20 20:23:48 1617 @@ -3,6 +3,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.net.ConnectivityManager; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -79,6 +80,7 @@ static final String URL = "http://omdeling.info/mobil/ekl/login.php"; + ConnectivityManager connMgr; TelephonyManager telMgr; WebView web; String device = ""; @@ -104,7 +106,6 @@ intent.putExtra("state", false); sendBroadcast(intent); } - Log.d("EKL", "Airplane " + airplane); } catch (Settings.SettingNotFoundException e) { Log.d("EKL", "Exception " + e.getMessage() ); } @@ -113,6 +114,8 @@ telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); + connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); + device = telMgr.getLine1Number(); if (device == null || device.equals("")) { device = telMgr.getDeviceId(); @@ -146,7 +149,7 @@ web.setWebChromeClient(new CustomChromeClient() ); web.setWebViewClient( new DebugWebViewClient() ); - if (telMgr.getSimState() == TelephonyManager.SIM_STATE_READY && telMgr.getDataState() == TelephonyManager.DATA_CONNECTED) { + if ( (telMgr.getSimState() == TelephonyManager.SIM_STATE_READY && telMgr.getDataState() == TelephonyManager.DATA_CONNECTED) || connMgr.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI) { web.loadUrl( URL ); } else { web.loadData("

afventer netværksforbindelse

", "text/html", "iso-8859-1");