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; |
19 |
import android.webkit.WebSettings; |
import android.webkit.WebSettings; |
20 |
import android.webkit.WebStorage.QuotaUpdater; |
import android.webkit.WebStorage.QuotaUpdater; |
21 |
import android.webkit.WebView; |
import android.webkit.WebView; |
22 |
|
import android.webkit.WebViewClient; |
23 |
import android.widget.Toast; |
import android.widget.Toast; |
24 |
|
|
25 |
public class EKLLauncherActivity extends Activity { |
public class EKLLauncherActivity extends Activity { |
77 |
} |
} |
78 |
|
|
79 |
} |
} |
80 |
|
|
81 |
|
class DummyWebViewClient extends WebViewClient { |
82 |
|
} |
83 |
|
|
84 |
static final String URL = "http://omdeling.info/mobil/ekl/login.php"; |
static final String URL = "http://omdeling.info/mobil/ekl/login.php"; |
85 |
|
|
86 |
|
ConnectivityManager connMgr; |
87 |
TelephonyManager telMgr; |
TelephonyManager telMgr; |
88 |
WebView web; |
WebView web; |
89 |
String device = ""; |
String device = ""; |
109 |
intent.putExtra("state", false); |
intent.putExtra("state", false); |
110 |
sendBroadcast(intent); |
sendBroadcast(intent); |
111 |
} |
} |
|
Log.d("EKL", "Airplane " + airplane); |
|
112 |
} catch (Settings.SettingNotFoundException e) { |
} catch (Settings.SettingNotFoundException e) { |
113 |
Log.d("EKL", "Exception " + e.getMessage() ); |
Log.d("EKL", "Exception " + e.getMessage() ); |
114 |
} |
} |
117 |
|
|
118 |
|
|
119 |
telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); |
telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); |
120 |
|
connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); |
121 |
|
|
122 |
device = telMgr.getLine1Number(); |
device = telMgr.getLine1Number(); |
123 |
if (device == null || device.equals("")) { |
if (device == null || device.equals("")) { |
124 |
device = telMgr.getDeviceId(); |
device = telMgr.getDeviceId(); |
150 |
settings.setSupportMultipleWindows(false); |
settings.setSupportMultipleWindows(false); |
151 |
|
|
152 |
web.setWebChromeClient(new CustomChromeClient() ); |
web.setWebChromeClient(new CustomChromeClient() ); |
153 |
web.setWebViewClient( new DebugWebViewClient() ); |
web.setWebViewClient( new DummyWebViewClient() ); // skal have en webviewclient for at kunne styre ved forlad tur |
154 |
|
|
155 |
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) { |
156 |
web.loadUrl( URL ); |
web.loadUrl( URL ); |
157 |
} else { |
} else { |
158 |
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"); |