You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2017/06/07 13:17:58 UTC

cordova-plugin-device-orientation git commit: CB-12667 android: Added logic for searching sensors from Samsung vendor

Repository: cordova-plugin-device-orientation
Updated Branches:
  refs/heads/master 41051a2c5 -> a77b4fa0a


CB-12667 android: Added logic for searching sensors from Samsung vendor


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/commit/a77b4fa0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/tree/a77b4fa0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/diff/a77b4fa0

Branch: refs/heads/master
Commit: a77b4fa0a410d22a0d36edddb0cc0a603d8dea43
Parents: 41051a2
Author: Nikita Matrosov <v-...@microsoft.com>
Authored: Tue Apr 18 11:58:25 2017 +0300
Committer: Nikita Matrosov <v-...@microsoft.com>
Committed: Wed Jun 7 16:10:20 2017 +0300

----------------------------------------------------------------------
 src/android/CompassListener.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation/blob/a77b4fa0/src/android/CompassListener.java
----------------------------------------------------------------------
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 class CompassListener extends CordovaPlugin implements SensorEventListene
     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 @@ public class CompassListener extends CordovaPlugin implements SensorEventListene
         @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);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org