28 |
import android.webkit.WebView; |
import android.webkit.WebView; |
29 |
import android.webkit.WebViewClient; |
import android.webkit.WebViewClient; |
30 |
import android.widget.EditText; |
import android.widget.EditText; |
31 |
|
import android.widget.Toast; |
32 |
|
|
33 |
public class EKLLauncherActivity extends Activity { |
public class EKLLauncherActivity extends Activity { |
34 |
|
|
75 |
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, final JsPromptResult result) { |
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, final JsPromptResult result) { |
76 |
String msg = message.trim().toLowerCase(); |
String msg = message.trim().toLowerCase(); |
77 |
|
|
78 |
if (msg.equals("pda identifikation mangler")) { |
if (msg.equals("ekl identifikation mangler")) { |
79 |
result.confirm(device); |
result.confirm(device); |
80 |
|
|
81 |
timeoutHandler.sendEmptyMessageDelayed(1, 500); //efter pdaID er sendt til app'en skal vi genindlæse siden for at tvinge den til at hente data |
timeoutHandler.sendEmptyMessageDelayed(1, 500); //efter pdaID er sendt til app'en skal vi genindlæse siden for at tvinge den til at hente data |
104 |
return super.onJsPrompt(view, url, message, defaultValue, result); |
return super.onJsPrompt(view, url, message, defaultValue, result); |
105 |
} |
} |
106 |
} |
} |
|
|
|
107 |
} |
} |
108 |
|
|
109 |
class DummyWebViewClient extends WebViewClient { |
class DummyWebViewClient extends WebViewClient { |
110 |
} |
} |
111 |
|
|
112 |
static final String URL = "http://omdeling.info/mobil/ekl/login.php"; |
static final String URL = "http://omdeling.info/mobil_gpstrack/ekl/login.php"; |
113 |
|
|
114 |
LocationManager locMgr; |
LocationManager locMgr; |
115 |
ConnectivityManager connMgr; |
ConnectivityManager connMgr; |
119 |
|
|
120 |
PowerManager.WakeLock wakeLock; |
PowerManager.WakeLock wakeLock; |
121 |
|
|
122 |
|
SimHandler simHandler = new SimHandler(); |
123 |
|
|
124 |
/** Called when the activity is first created. */ |
/** Called when the activity is first created. */ |
125 |
@Override |
@Override |
126 |
public void onCreate(Bundle savedInstanceState) { |
public void onCreate(Bundle savedInstanceState) { |
140 |
} catch (Settings.SettingNotFoundException e) { |
} catch (Settings.SettingNotFoundException e) { |
141 |
Log.d("EKL", "Exception " + e.getMessage() ); |
Log.d("EKL", "Exception " + e.getMessage() ); |
142 |
} |
} |
143 |
|
|
144 |
|
locMgr = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); |
145 |
|
telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); |
146 |
|
connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); |
147 |
|
|
148 |
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); |
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); |
149 |
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "EklLauncher"); |
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "EklLauncher"); |
150 |
wakeLock.acquire(); |
wakeLock.acquire(); |
151 |
|
|
152 |
|
|
|
locMgr = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); |
|
|
telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); |
|
|
connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); |
|
153 |
|
|
154 |
device = telMgr.getLine1Number(); |
device = telMgr.getLine1Number(); |
155 |
if (device == null || device.equals("")) { |
if (device == null || device.equals("")) { |
156 |
device = telMgr.getDeviceId(); |
device = telMgr.getSimSerialNumber(); |
157 |
|
|
158 |
if(device == null) |
if(device == null) |
159 |
device = ""; |
device = ""; |
160 |
} |
} |
161 |
|
|
162 |
|
Toast.makeText(EKLLauncherActivity.this, "Device:"+device, Toast.LENGTH_SHORT).show(); |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
setContentView(R.layout.main); |
setContentView(R.layout.main); |
253 |
|
|
254 |
|
|
255 |
|
|
256 |
SimHandler simHandler = new SimHandler(); |
|
257 |
|
|
258 |
class SimHandler extends Handler { |
class SimHandler extends Handler { |
259 |
|
|