CB-12667 android: Added logic for searching sensors from Samsung vendor
diff --git a/src/android/CompassListener.java b/src/android/CompassListener.java
index 194db0d..567ec99 100755
--- a/src/android/CompassListener.java
+++ b/src/android/CompassListener.java
@@ -47,6 +47,7 @@
public static int STARTING = 1;
public static int RUNNING = 2;
public static int ERROR_FAILED_TO_START = 3;
+ private static int SAMSUNG_SENSOR_TYPE_ORIENTATION = 65558;
public long TIMEOUT = 30000; // Timeout in msec to shut off listener
@@ -167,6 +168,11 @@
@SuppressWarnings("deprecation")
List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION);
+ // Sensors from 'Samsung Electronic' vendor have another orientation type (65558)
+ if (list != null && list.size() == 0) {
+ list = this.sensorManager.getSensorList(CompassListener.SAMSUNG_SENSOR_TYPE_ORIENTATION);
+ }
+
// If found, then register as listener
if (list != null && list.size() > 0) {
this.mSensor = list.get(0);