After creating the IALocationManager
, you can register and unregister for periodic updates of the user’s current location. To this end, you have to implement the IALocationListener
interface and override its onLocationChanged()
callback method. This is the place where your location updates will be delivered as IALocation
objects
private IALocationListener mIALocationListener = new IALocationListener() { // Called when the location has changed. @Override public void onLocationChanged(IALocation location) { Log.d(TAG, "Latitude: " + location.getLatitude()); Log.d(TAG, "Longitude: " + location.getLongitude()); Log.d(TAG, "Floor number: " + location.getFloorLevel()); } };
To start receiving location updates you also have to call the requestLocationUpdates()
method, where you provide an instance of IALocationRequest
as a parameter. It may include extra options for location manager. You may consider doing this e.g. in your activity’s onResume()
and onPause()
methods respectively.
@Override protected void onResume() { super.onResume(); mIALocationManager.requestLocationUpdates(IALocationRequest.create(), mIALocationListener); }
Note that there are several complete examples in the IndoorAtlas Android Examples.
Location updates when offline
The new SDKs 3.0 and above run the state-of-the-art positioning algorithms on the device. Accurate geomagnetic-aided tracking is available everywhere – also when your device is offline.
Read more here:
https://www.indooratlas.com/