3 |
import android.app.Activity; |
import android.app.Activity; |
4 |
import android.content.Context; |
import android.content.Context; |
5 |
import android.content.Intent; |
import android.content.Intent; |
6 |
|
import android.net.ConnectivityManager; |
7 |
import android.os.Bundle; |
import android.os.Bundle; |
8 |
import android.os.Handler; |
import android.os.Handler; |
9 |
import android.os.Message; |
import android.os.Message; |
80 |
|
|
81 |
static final String URL = "http://omdeling.info/mobil/ekl/login.php"; |
static final String URL = "http://omdeling.info/mobil/ekl/login.php"; |
82 |
|
|
83 |
|
ConnectivityManager connMgr; |
84 |
TelephonyManager telMgr; |
TelephonyManager telMgr; |
85 |
WebView web; |
WebView web; |
86 |
String device = ""; |
String device = ""; |
106 |
intent.putExtra("state", false); |
intent.putExtra("state", false); |
107 |
sendBroadcast(intent); |
sendBroadcast(intent); |
108 |
} |
} |
|
Log.d("EKL", "Airplane " + airplane); |
|
109 |
} catch (Settings.SettingNotFoundException e) { |
} catch (Settings.SettingNotFoundException e) { |
110 |
Log.d("EKL", "Exception " + e.getMessage() ); |
Log.d("EKL", "Exception " + e.getMessage() ); |
111 |
} |
} |
114 |
|
|
115 |
|
|
116 |
telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); |
telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); |
117 |
|
connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); |
118 |
|
|
119 |
device = telMgr.getLine1Number(); |
device = telMgr.getLine1Number(); |
120 |
if (device == null || device.equals("")) { |
if (device == null || device.equals("")) { |
121 |
device = telMgr.getDeviceId(); |
device = telMgr.getDeviceId(); |
149 |
web.setWebChromeClient(new CustomChromeClient() ); |
web.setWebChromeClient(new CustomChromeClient() ); |
150 |
web.setWebViewClient( new DebugWebViewClient() ); |
web.setWebViewClient( new DebugWebViewClient() ); |
151 |
|
|
152 |
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) { |
153 |
web.loadUrl( URL ); |
web.loadUrl( URL ); |
154 |
} else { |
} else { |
155 |
web.loadData("<html><body><h2>afventer netværksforbindelse</h2></body></html>", "text/html", "iso-8859-1"); |
web.loadData("<html><body><h2>afventer netværksforbindelse</h2></body></html>", "text/html", "iso-8859-1"); |