I want an method which gets lon and lat and should return true when user is under 2km location using the lon and lat he fixed..but i dont know how to implement it can any one give idea
Asked
Active
Viewed 51 times
2 Answers
0
Google has a feature called Geofencing. Look there on the sample app. Use this feature with caution because it can drain the battery.

Uriel Frankel
- 14,304
- 8
- 47
- 69
0
It's not clear what exactly you want to do but I'm guessing you want to calculate the distance between two locations(Or more), You can use distanceTo method:
Location a = new Location("Source");
Location b = new Location("Destination");
float distance = a.distanceTo(b); // The distance in Meters
See more information here - Calculating distance between two geographic locations
-
No am asking when user croses 2km distance from current location return false – thickar Oct 12 '14 at 12:04