/[projects]/android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java
ViewVC logotype

Diff of /android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1625 by torben, Wed Oct 26 12:15:52 2011 UTC revision 1925 by torben, Mon Feb 25 08:39:29 2013 UTC
# Line 11  import android.net.NetworkInfo; Line 11  import android.net.NetworkInfo;
11  import android.os.Bundle;  import android.os.Bundle;
12  import android.os.Handler;  import android.os.Handler;
13  import android.os.Message;  import android.os.Message;
14    import android.os.PowerManager;
15  import android.provider.Settings;  import android.provider.Settings;
16  import android.telephony.TelephonyManager;  import android.telephony.TelephonyManager;
17  import android.text.InputType;  import android.text.InputType;
# Line 27  import android.webkit.WebStorage.QuotaUp Line 28  import android.webkit.WebStorage.QuotaUp
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                    
# Line 73  public class EKLLauncherActivity extends Line 75  public class EKLLauncherActivity extends
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
# Line 102  public class EKLLauncherActivity extends Line 104  public class EKLLauncherActivity extends
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;
# Line 116  public class EKLLauncherActivity extends Line 117  public class EKLLauncherActivity extends
117          WebView web;          WebView web;
118          String device = "";          String device = "";
119                    
120            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
# Line 137  public class EKLLauncherActivity extends Line 140  public class EKLLauncherActivity extends
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);
149            wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "EklLauncher");
150            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);
# Line 202  public class EKLLauncherActivity extends Line 211  public class EKLLauncherActivity extends
211      }      }
212    
213          @Override          @Override
214            protected void onDestroy() {
215                    super.onDestroy();
216                    wakeLock.release();
217            }
218    
219            @Override
220          public boolean onCreateOptionsMenu(Menu menu) {          public boolean onCreateOptionsMenu(Menu menu) {
221                  MenuItem item;                  MenuItem item;
222                  item = menu.add(0, 1, 0, "Genindlæs side");                  item = menu.add(0, 1, 0, "Genindlæs side");
# Line 238  public class EKLLauncherActivity extends Line 253  public class EKLLauncherActivity extends
253                    
254                    
255    
256          SimHandler simHandler = new SimHandler();  
257                    
258          class SimHandler extends Handler {          class SimHandler extends Handler {
259                                    

Legend:
Removed from v.1625  
changed lines
  Added in v.1925

  ViewVC Help
Powered by ViewVC 1.1.20