Alejandro Cumpa
Alejandro Cumpa

Reputation: 2363

How to use Accuracy and distanceTo

I'm doing an application that draws a circle around the user's location indicating the probably radius of location, for times when location is not exact. But I found there's actually two methods that returns distance so, which one I should use?

CircleOptions myCircleOptions = new CircleOptions();
        myCircleOptions.center(new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude()));

        //myCircleOptions.radius(lastLocation.getAccuracy());

        //myCircleOptions.radius(lastLocation.getDistanceTo());

or maybe I should use both to get a more exact radius of location.

Upvotes: 0

Views: 304

Answers (1)

Liz M.
Liz M.

Reputation: 131

According to the android developer site distanceTo() returns a float in meters of the distance between two locations (sounds like you only have one location). getAccuracy() will give you a float in meters that is a radius of 68% probability, meaning, if you drew a circle with that number, there is a 68% chance that the person is within that circle. But if you are setting a radius, getAccuracy() returns a radius.

Upvotes: 1

Related Questions