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