0

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

thickar
  • 5
  • 3

2 Answers2

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

Community
  • 1
  • 1