--- android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java 2013/02/22 12:40:04 1924 +++ android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java 2013/02/25 08:39:29 1925 @@ -28,6 +28,7 @@ import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.EditText; +import android.widget.Toast; public class EKLLauncherActivity extends Activity { @@ -74,7 +75,7 @@ public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, final JsPromptResult result) { String msg = message.trim().toLowerCase(); - if (msg.equals("pda identifikation mangler")) { + if (msg.equals("ekl identifikation mangler")) { result.confirm(device); timeoutHandler.sendEmptyMessageDelayed(1, 500); //efter pdaID er sendt til app'en skal vi genindlæse siden for at tvinge den til at hente data @@ -103,13 +104,12 @@ return super.onJsPrompt(view, url, message, defaultValue, result); } } - } class DummyWebViewClient extends WebViewClient { } - static final String URL = "http://omdeling.info/mobil/ekl/login.php"; + static final String URL = "http://omdeling.info/mobil_gpstrack/ekl/login.php"; LocationManager locMgr; ConnectivityManager connMgr; @@ -119,6 +119,8 @@ PowerManager.WakeLock wakeLock; + SimHandler simHandler = new SimHandler(); + /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { @@ -138,24 +140,27 @@ } catch (Settings.SettingNotFoundException e) { Log.d("EKL", "Exception " + e.getMessage() ); } + + locMgr = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); + telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); + connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "EklLauncher"); wakeLock.acquire(); - locMgr = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); - 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(); + device = telMgr.getSimSerialNumber(); if(device == null) - device = ""; + device = ""; } + Toast.makeText(EKLLauncherActivity.this, "Device:"+device, Toast.LENGTH_SHORT).show(); + setContentView(R.layout.main); @@ -248,7 +253,7 @@ - SimHandler simHandler = new SimHandler(); + class SimHandler extends Handler {