0

Not sure what is going on here, but I want it to make an additional circle every second as the device moves. All it does is make 1 circle. I want the circles to highlight the route I have taken. Recommendations? Thanks

LocationManager locationmanager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria cr = new Criteria();
String provider = locationmanager.getBestProvider(cr, true);
Location location = locationmanager.getLastKnownLocation(provider);

locationmanager.requestLocationUpdates(provider, 1000, 0, (LocationListener) this);




CircleOptions circleOptions = new CircleOptions()
.center(new LatLng(location.getLatitude(), location.getLongitude()));
circleOptions.radius(3.048); // In meters


mMap.addCircle(circleOptions);
Lucas
  • 3,376
  • 6
  • 31
  • 46
johnsonjp34
  • 3,139
  • 5
  • 22
  • 48

1 Answers1

3

Put:

CircleOptions circleOptions = new CircleOptions()
        .center(new LatLng(location.getLatitude(), location.getLongitude()));
circleOptions.radius(3.048); // In meters

mMap.addCircle(circleOptions);

inside onLocationChanged(Location location) callback.

MaciejGórski
  • 22,187
  • 7
  • 70
  • 94