'How to find people using my app within some radius of my location

Hi I build the app to find all bar and cafe within some radius of my location with API of google, now I want to add all people using my app within some radius of my location that online and there profile data existing in my database (mySQL) to my list with there profile data. Any ideas how to start to do that? With API google or with XMPP? Or another way? Thank you.



Solution 1:[1]

You can refer here to know about getting user current location.

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
    NSLog(@"OldLocation %f %f", oldLocation.coordinate.latitude, oldLocation.coordinate.longitude);
    NSLog(@"NewLocation %f %f", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
}

You Must need a web service that stores locations of each devices when the app is running, then from your app send a query to the web-service from there you will find the list of device using the app in a required range or radious.

though It's not a very elegant solution since the user is always polling the server and the web request can fail more often than you'd want. I heard about socket programming where the user keeps a live connection to the server and when ever the server changes, the user is notified, sounds more like the right approach but also sounds much harder :P

see my answer here For Showing Multiple annotation on MAP.

Solution 2:[2]

You need to establish a server that the individual clients can check in to when they are online and transmit their location. Then you need to have an API for searching locations around a given radius.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 Cocoanetics