title: changing an android service to execute at specific intervals
body: <p>I'm using an android example of a service that gets current location, it works fine but I would like to know what changes I would have to make so it only checked for the current location at specific time intervals (e.g. every 2 minutes), instead of just doing it continuously.</p>
  
  <pre><code>public class YourService extends Service implements LocationListener {
      LocationManager mLocationManager;
  
  public IBinder onBind(Intent intent) {
      // This won't be a bound service, so simply return null
      Log.v("WEAVER_", "Service_OnBind...");
      return null;
  }
  
  @Override
  public void onCreate() {
      // This will be called when your Service is created for the first time
      // Just do any operations you need in this method.
      Log.v("WEAVER_", "Service_OnCreate...");
  
      mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
  
      mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1,
              1, this);
  
  
  }
  
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
      return super.onStartCommand(intent, flags, startId);
  }
  @Override
  public void onDestroy(){
      super.onDestroy();
      Log.v("WEAVER_","Service_OnDestroy");
      mLocationManager.removeUpdates(this);
      mLocationManager = null;
  }
  @Override
  public void onLocationChanged(Location location) {
      Log.v("WEAVER_","Service_Location Change");
  
      String msg = "New Latitude: " + location.getLatitude()
              + "New Longitude: " + location.getLongitude();
  
  
  
  
  
  
  
  
        Toast.makeText(getBaseContext(), msg, Toast.LENGTH_LONG).show();
  
  }
  
  @Override
  public void onStatusChanged(String provider, int status, Bundle extras) {
  
  }
  
  @Override
  public void onProviderEnabled(String provider) {
  
  }
  
  
  
  @Override
  public void onProviderDisabled(String provider) {
  
  }
  </code></pre>
  
  <p>}</p>