Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Get lat long using GPS in every 10 min.</p> <pre><code>// Des: Start Device's GPS and get current latitude and longitude public void GPS() throws IOException { // Des: This is a background service and called after every 10 minutes and fetch latitude-longitude values background = new Thread(new Runnable() { @Override public void run() { for (int i = 0; i &lt; j; i++) { if (ProjectStaticVariable.GPSExit == true ) { try { Thread.sleep(600000); //10 minutes mainhandler.sendMessage(mainhandler.obtainMessage()); j++; } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } } } }); background.start(); mainhandler = new Handler() { public void handleMessage(Message msg) { // Check Internet status isInternetPresent = cd.isConnectingToInternet(); if (isInternetPresent) { lat_long_Service_flag = true; mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mlocListener = new MyLocationListener(getApplicationContext()); mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, mlocListener); mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); } } }; } // Des: Location Listener through which we get current latitude and longitude public class MyLocationListener implements LocationListener { public MyLocationListener(Context mContext) {} public MyLocationListener(Runnable runnable) {} @Override public void onLocationChanged(Location loc) { longitude = loc.getLongitude(); latitude = loc.getLatitude(); final_latitude = Double.toString(latitude); final_longitude = Double.toString(longitude); } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload