title: Update Location on Interval
body: <p>This is the current code I have to show the last known good location as a marker on a Google Map. All is functional, but I'd like to update the location on an interval (say 1 minute or 5 minutes.) What is the best way to implement this given the current code I'm using?</p>
  
  <pre><code>import android.location.Criteria;
  import android.location.Location;
  import android.location.LocationManager;
  import android.os.Bundle;
  import android.preference.PreferenceManager;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.content.SharedPreferences;
  import android.content.SharedPreferences.Editor;
  import com.google.android.gms.common.GooglePlayServicesUtil;
  import com.google.android.gms.maps.CameraUpdate;
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapFragment;
  import com.google.android.gms.maps.model.BitmapDescriptorFactory;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.Marker;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  public class Parking extends Activity implements OnClickListener {
  
      private GoogleMap map;
  
      Button b;
  
      public static final String LATITUDE = "latitude";
      public static final String LONGITUDE = "longitude";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.parking);
  
          b = (Button)findViewById(R.id.button1);
          b.setOnClickListener(this);
  
          map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
  
          if (map!=null)
          {       
  
          //Set Map Type
          map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
  
          //Enable MyLocation Layer of Google Map
          map.setMyLocationEnabled(true);
  
          //Get LocationManager object from System Service LOCATION_SERVICE
          LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
  
          //Create a criteria object to retrieve provider
          Criteria criteria = new Criteria();
  
          //Get the best provider
          String provider = locationManager.getBestProvider(criteria, true);
  
          //Get Current Location
          Location myLocation = locationManager.getLastKnownLocation(provider);
  
          //Get Lat/Long of the current location
          double latitude = myLocation.getLatitude();
          double longitude = myLocation.getLongitude();
  
          //Create a latLng object for the current location
          LatLng latLng = new LatLng(latitude, longitude);
  
          //Show the current location in Google Map
          map.moveCamera(CameraUpdateFactory.newLatLng(latLng));
  
          //Zoom to location
          map.animateCamera(CameraUpdateFactory.zoomTo(16));
  
          //Add marker
          map.addMarker(new MarkerOptions()
              .position(new LatLng(latitude, longitude))
              .title("You Are Here")
          );
  
  
  
  
          }//end if map !null
      }
  </code></pre>