I'm writing an app that utilizes parse for cloud data storage. I recently was told that the people I'm writing this for are opening a second location, and would like to know which location a user is checking in to/recording data at. I've found the google code at: http://developer.android.com/training/location/geofencing.html
that defines how to use geofencing, as well as how to get the last known gps/network location.
http://developer.android.com/guide/topics/location/strategies.html
But I can't tell if either one of these are what I need. Basically I'm trying to do the following:
I'm not sure if geofencing is proper for this case, as i just need to know rough area from a point..but the basic location getting sample doesn't seem to show how to check when the phone is near a point.
To this point, I've found the following: http://www.javacodegeeks.com/2011/01/android-proximity-alerts-tutorial.html
This seems to be the best option, except it constantly checks for "distance" from the set point, and I need to tell once if the user is near one or the other locations.
Something like this maybe:
Location me = new Location("");
Location dest = new Location("");
me.setLatitude(myLat);
me.setLongitude(myLong);
dest.setLatitude(destLat);
dest.setLongitude(destLong);
float dist = me.distanceTo(dest);
You can then repeat for the second location and store both distances then compare to see the smallest.