--- android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java 2013/02/25 08:39:29 1925 +++ android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java 2013/02/25 10:16:25 1926 @@ -1,5 +1,6 @@ package dk.thoerup.ekllauncher; +import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; @@ -109,6 +110,7 @@ class DummyWebViewClient extends WebViewClient { } + static final String LOGTAG = "EklLauncher"; static final String URL = "http://omdeling.info/mobil_gpstrack/ekl/login.php"; LocationManager locMgr; @@ -122,15 +124,19 @@ SimHandler simHandler = new SimHandler(); /** Called when the activity is first created. */ - @Override + @SuppressLint("SetJavaScriptEnabled") + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + Log.e(LOGTAG, "Starting"); + getWindow().requestFeature(Window.FEATURE_PROGRESS); try { int airplane = Settings.System.getInt(this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON); + if (airplane > 0) { Settings.System.putInt(this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); @@ -159,7 +165,7 @@ device = ""; } - Toast.makeText(EKLLauncherActivity.this, "Device:"+device, Toast.LENGTH_SHORT).show(); + Toast.makeText(EKLLauncherActivity.this, "Device: "+device, Toast.LENGTH_SHORT).show(); @@ -188,10 +194,9 @@ web.setWebChromeClient(new CustomChromeClient() ); web.setWebViewClient( new DummyWebViewClient() ); // skal have en webviewclient for at kunne styre ved forlad tur - - simHandler.sendEmptyMessage(0); - - + //Hvis at tlf rebooter mit i et område uden dækning er det ikke smart at vi skal vente på data + //simHandler.sendEmptyMessage(0); + web.loadUrl( URL ); if (!locMgr.isProviderEnabled(LocationManager.GPS_PROVIDER )) { @@ -201,13 +206,27 @@ builder.setMessage("GPS er slået fra på telefonen!\nSæt et flueben ved GPS i næste vindue og tryk derefter på tilbage knappen (nederst på telefonen)") .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { - Intent myIntent = new Intent( Settings.ACTION_SECURITY_SETTINGS ); + Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS ); startActivity(myIntent); } }) .create() .show(); } + + } + + void showMessage(String msg) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(msg) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }) + .create() + .show(); + } @Override