mesibo Location APIs

Searching Users and Groups Based on Location

The mesibo location search APIs allow you to search for other users and groups based on location, distance, location age, and more. Your users can search based on the current or a custom location. To implement location search feature in your app, you need to follow these two steps:

Step 1 - Implement Mesibo Profile Search Listener

You need to implement the MesiboProfileSearchListener interface to receive profile search results. The following are listener functions:

  • Mesibo_onProfileSearchResults will be called when the initial profile search results are received from server
  • Mesibo_onProfileSearchUpdate will be called when the profile search results are updated based on a subscription (for future updates).

Step 2 - Create a MesiboProfileSearch Instance

Create a MesiboProfileSearch instance and initialize it with the desired search parameters, such as location, search distance, maximum location age, etc.

MesiboProfileSearch profileSearch = new MesiboProfileSearch();
profileSearch.setDistance(1000); // 1000 meters
profileSearch.setMaxAge(3600); // within last hour;
val profileSearch:MesiboProfileSearch = MesiboProfileSearch();
profileSearch.setDistance(1000); // 1000 meters
profileSearch.setMaxAge(3600); // 1 hour;
let profileSearch = MesiboProfileSearch()
MesiboProfileSearch *profileSearch = [MesiboProfileSearch new];
[profileSearch setListener:self];
[profileSearch setDistance:1000];
[profileSearch setMaxAge:3600];
[profileSearch search];

Once you call, the mesibo API will contact the server and deliver search results through the MesiboProfileSearchListener implemented in step 1.

After receiving the initial search results, you can keep calling MesiboProfileSearch.searchMore() to get more search results.

Making a Profile Searchable

Users can make their profiles searchable or not searchable by calling the setSearchable() API on their self profile.


Restricting Search Range

You can configure a user to be searchable within a certain radius from their current location using the locationManager.setSearchableDistance() API. If set, the user will appear in the search results only if they are within the specified radius from the user performing the search.

locationManager.setSearchableDistance(5000); // 5000 meters

By following these steps, you can seamlessly integrate location-based search functionality into your application, allowing users to discover nearby users and groups based on their preferences and requirements.