Reputation: 301
I have latitude and longitude of a current location. I want to check if target location (latitude and longitude) is close with 50 meter radius to the current location.
I am new to android.if anyone have solution about this.please reply.
Upvotes: 11
Views: 4159
Reputation: 28727
use the built in distance calculation:
Location loc;
.....
float radius = 50.0;
float distance = loc.distanceTo(loc2);
if (distance < radius) then inside.
Upvotes: 17