I'm building a location based application.
Lets say that i have user A and i have a latitude and longitude values of his current location.
I got user B,C,D and thier locations as well.. For the example - user B + D are in a radius of 5km from user A and user C is in 12km radius from user A and I want to know how can i make a function that will tell me that whose near to me by 4/5/6/7km and etc.. If i user A wants users that are 8.5km away from him i will have as a result user B + D and thier distance from user A.
Now.. i know that i can use the Location class and use the distance function to calculate the distance between two users. But the problem is that if i want to calculate that for the radius distance i need to fetch the entire users list from my database and send it to the client to start calculating distances between him and those i fetched from the server. Now i dont want to do that off course if there is a better and more effecient way..
Firstly, I thought off using http request or some mathematical functions to calculate the distance between my users on the server side but the client (Android) offers very good tools to do so , so because of that I am lost of knowing to is the best thing to do.
Thanks head up :)