Skip to content

Compass

Michał Gasztold edited this page Jul 5, 2017 · 3 revisions

The SDK uses built in motion and magnetic field sensors to calculate the compass bearing. To receive bearing updates in the mobile application an UbuduCompassListener has to be used:

mIndoorLocationManager.setCompassListener(new UbuduCompassListener() {
        @Override
        public void onAzimuthUpdated(float azimuth) {
            // azimuth in a range from 0 to 359 degrees
        }
    });

Note: The magnetic sensor available in Android devices is not always accurate and demands simple calibration that can be done when the app is running:

  1. Wave your phone in the air making a figure of 8 couple of times.

  2. You may need to repeat the above until direction shown on your map display gets reasonable.

    Image comes from support.google.com.

Clone this wiki locally