android - Set a random Geofence location 2km away based off a users current location -
i'm using using google-play-services-location track location of user.
when user clicks button start challenge , user need go random location within 2km of current longitude , latitude (computed randomly application logic).
geofencing location determine if arrived.
is possible set geofence in way, , how go attempting it?
first
1 degree of longitude = 111km
1 degree of latitude = 111km
so 2km both longitude , latitude equal .018 degrees
second
you users location longitude , latitude add random longitude , latitude equal .018.
for example: add longitude of .007 , latitude of .011 (which equals .018) users location. give location 2km away user.
if want closest part of fence 2km away double degree total .036 , make fence radius 2km.
lastly
to geofence similar above 4 times give square fence. or once give radius. distance upto how big want fence be
Comments
Post a Comment