mesibo Location APIs - Secure Location Synchronization, Sharing, and Search
mesibo location syncronization APIs is in beta and available in v2.4.9 onward. This is a preliminary documentation.
mesibo secure location APIs allow you to add various location-based features to your app. While mesibo location APIs are implemented on top of native platform location APIs, they offer many enhancements by implementing various algorithms such as filtering, spurious and fake location detection, synchronization, efficient battery usage, etc., to make your implementation secure and cross-platform. Some of the features include:
- Location tracking for users and groups
- Secure location subscription (permission-based)
- Searching users and groups based on location
- Subscribing to search updates
- Protecting users from triangularization and exact location disclosure
- Nearby users alert
- Nearby groups
- Region entry alerts And more
In this document, we will describe how to use mesibo Location APIs.
Get Started
mesibo location APIs absorb all the complexities and offers you easy-to-use APIs. In just two steps and a few lines of code, you can add powerful location synchronization and search features to any app:
Step 1 - Implement Mesibo Location Listener
You need to implement the MesiboLocationListener interface so that you can receive various real-time updates. The following are the listener functions:
Mesibo_onDeviceLocation
will be called when the device location changes. The Mesibo API performs various checks on the location validity before invoking this function.Mesibo_onLocationReceived
will be called when a location is received for a user or a group.Mesibo_onLocationRequest
will be called when a location subscription is requested. You can ignore or approve the location subscription based on your app's criteria.Mesibo_onLocationShared
will be called when a user or app approves a location subscription request.Mesibo_onLocationError
will be called for any location-related errors.
Step 2 - Initializing the Location APIs
To initialize the mesibo location APIs, you need to get an instance of the MesiboLocationManager class and configure it with your desired settings. For example, you can set the minimum distance (in meters) for receiving location updates.
Create location configuration (OPTIONAL):
MesiboLocationConfig locationConfig = new MesiboLocationConfig();
locationConfig.minDistance = 250;
Initialize and start the location manager by passing the location configuration:
MesiboLocationManager locationManager = MesiboLocationManager.getInstance();
locationManager.addListener(this);
locationManager.start(locationConfig);
Create location configuration (OPTIONAL):
val locationConfig = MesiboLocationConfig();
locationConfig.minDistance = 250;
Initialize and start the location manager by passing the location configuration:
val locationManager = MesiboLocationManager.getInstance()
locationManager.addListener(this)
locationManager.start(locationConfig)
Create location configuration (OPTIONAL):
let locationConfig = MesiboLocationConfig()
locationConfig.minDistance = 250
Initialize and start the location manager by passing the location configuration:
let locationMager = MesiboLocationManager.getInstance()
locationMager.addListener(listener)
locationMager.start(locationConfig)
Create location configuration (OPTIONAL):
MesiboLocationConfig *locationConfig = [MesiboLocationConfig new];
locationConfig.minDistance = 250;
Initialize and start the location manager by passing the location configuration:
MesiboLocationManager *locationMager = [MesiboLocationManager getInstance];
[locationMager addListener:self];
[locationMager start:locationConfig];
_mesibo.getLocationManager().setListener(this);
_mesibo.getLocationManager().start(null);
Once you call MesiboLocationManager.start()
, it will start synchronizing the user's location with the server. You will be notified of device location changes through the Mesibo_onDeviceLocation
listener function.
Accessing the Device Location
You can retrieve the last known device location anytime by calling the getDeviceLocation()
method:
MesiboLocation location = locationManager.getDeviceLocation();
This will return a MesiboLocation object containing the device's latitude, longitude, timestamp, and other location-related information.
You can use locationManager.setAccessLevel()
to restrict the location access to certain sets of users only.
Restricting Location Access
You can use the setAccessLevels()
method to restrict location access to certain sets of users only,
locationManager.setAccessLevels([1,3]);
Refer to the Users and Profiles
documentation to learn about the access levels.
In the next step, we will explore how to access and subscribe to other users' locations.