From e3b2452ba2b4ec3dfc83129e7555f70c84ca3373 Mon Sep 17 00:00:00 2001 From: Tsoi Yat Shing Date: Thu, 16 Apr 2020 16:08:35 +0800 Subject: [PATCH] Update the heading, even if the sensor is unreliable. This makes it possible to use a different indicator for the unreliable case, instead of just changing the RenderMode to NORMAL. --- .../mapboxsdk/location/LocationComponentCompassEngine.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java index 4862297f2..39c1a4cd8 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java @@ -106,7 +106,9 @@ class LocationComponentCompassEngine implements CompassEngine, SensorEventListen public void onSensorChanged(@NonNull SensorEvent event) { if (lastAccuracySensorStatus == SensorManager.SENSOR_STATUS_UNRELIABLE) { Logger.d(TAG, "Compass sensor is unreliable, device calibration is needed."); - return; + // Update the heading, even if the sensor is unreliable. + // This makes it possible to use a different indicator for the unreliable case, instead of just changing the RenderMode to NORMAL. + //return; } if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) { rotationVectorValue = getRotationVectorFromSensorEvent(event);