You can implement it yourself, without using any frameworks, it is very simple ...
I suppose you want to check if you are in a circle geo object or not.
To do this, simply calculate the distance between the center of the circle and your location (longitude, latitude). If the distance is less than the radius of your circle, then you are in the geosonde, otherwise you are outside the geoforum.
Like this:
boolean checkInside(Circle circle, double longitude, double latitude) { return calculateDistance( circle.getLongitude(), circle.getLatitude(), longitude, latitude ) < circle.getRadius();}
To calculate the distance between two points, you can use this:
double calculateDistance( double longitude1, double latitude1, double longitude2, double latitude2) { double c = Math.sin(Math.toRadians(latitude1)) * Math.sin(Math.toRadians(latitude2)) + Math.cos(Math.toRadians(latitude1)) * Math.cos(Math.toRadians(latitude2)) * Math.cos(Math.toRadians(longitude2) - Math.toRadians(longitude1)); c = c > 0 ? Math.min(1, c) : Math.max(-1, c); return 3959 * 1.609 * 1000 * Math.acos(c); }
This formula is called the Haversin formula. It takes into account the curvature of the land. Results are shown in meters.
I also described this on my blog:
source share