You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2022/08/29 10:39:23 UTC

[GitHub] [cordova-plugin-device-orientation] mgurzixo opened a new pull request, #78: Rewrite Android native plugin

mgurzixo opened a new pull request, #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78

   <!--
   Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   Android
   
   
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   On Android, the plugin used a Sensor.TYPE_ORIENTATION which is [deprecated](https://developer.android.com/guide/topics/sensors/sensors_position). This sensor was more and more https://github.com/apache/cordova-plugin-device-orientation/issues/64 in new devices. So now the plugin uses Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD which are available everyw[here](https://developer.android.com/guide/topics/sensors/sensors_position#sensors-pos-orient). They are fused together as instructed here, except that the SensorManager.getOrientation() has a [bug that will not be fixed](https://issuetracker.google.com/issues/37127944). [Stochastically](https://stackoverflow.com/users/2110762/stochastically) found a [solution](https://stackoverflow.com/questions/15537125/inconsistent-orientation-sensor-values-on-android-for-azimuth-yaw-and-roll/16418016#16418016) that works like a charm and is used here.
   
   <!-- If it fixes an open issue, please link to the issue here. -->
   [Increasing reports of compass not working on some android devices](https://github.com/apache/cordova-plugin-device-orientation/issues/64)
   
   
   ### Description
   <!-- Describe your changes in detail -->
   rewrote ` src/android/CompassListener.java`
   
   
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   tested on poco X3 NFC, OnePlus2, OnePlus6 & Samsung SM-T590.
   
   
   
   ### Checklist
   
   - [X] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [X] I've updated the documentation if necessary
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] erisu commented on a diff in pull request #78: Rewrite Android native plugin

Posted by GitBox <gi...@apache.org>.
erisu commented on code in PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#discussion_r957392864


##########
src/android/CompassListener.java:
##########
@@ -38,259 +40,306 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.os.Handler;
 import android.os.Looper;
 
+import android.util.Log; // MG
+
 /**
  * This class listens to the compass sensor and stores the latest heading value.
  */
 public class CompassListener extends CordovaPlugin implements SensorEventListener {
 
-    public static int STOPPED = 0;
-    public static int STARTING = 1;
-    public static int RUNNING = 2;
-    public static int ERROR_FAILED_TO_START = 3;
-
-    public long TIMEOUT = 30000;        // Timeout in msec to shut off listener
-
-    int status;                         // status of listener
-    float heading;                      // most recent heading value
-    long timeStamp;                     // time of most recent value
-    long lastAccessTime;                // time the value was last retrieved
-    int accuracy;                       // accuracy of the sensor
-
-    private SensorManager sensorManager;// Sensor manager
-    Sensor mSensor;                     // Compass sensor returned by sensor manager
-
-    private CallbackContext callbackContext;
-
-    /**
-     * Constructor.
-     */
-    public CompassListener() {
-        this.heading = 0;
-        this.timeStamp = 0;
-        this.setStatus(CompassListener.STOPPED);
-    }
-
-    /**
-     * Sets the context of the Command. This can then be used to do things like
-     * get file paths associated with the Activity.
-     *
-     * @param cordova The context of the main Activity.
-     * @param webView The CordovaWebView Cordova is running in.
-     */
-    public void initialize(CordovaInterface cordova, CordovaWebView webView) {
-        super.initialize(cordova, webView);
-        this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE);
-    }
-
-    /**
-     * Executes the request and returns PluginResult.
-     *
-     * @param action                The action to execute.
-     * @param args          	    JSONArry of arguments for the plugin.
-     * @param callbackS=Context     The callback id used when calling back into JavaScript.
-     * @return              	    True if the action was valid.
-     * @throws JSONException 
-     */
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-        if (action.equals("start")) {
-            this.start();
-        }
-        else if (action.equals("stop")) {
-            this.stop();
+  public static int STOPPED = 0;
+  public static int STARTING = 1;
+  public static int RUNNING = 2;
+  public static int ERROR_FAILED_TO_START = 3;
+
+  public long TIMEOUT = 30000; // Timeout in msec to shut off listener
+
+  int status; // status of listener
+  float heading; // most recent heading value
+  long timeStamp; // time of most recent value
+  long lastAccessTime; // time the value was last retrieved
+  int accuracy; // accuracy of the sensor
+
+  private SensorManager sensorManager;// Sensor manager
+  Sensor mSensor; // Compass sensor returned by sensor manager
+
+  Sensor accelerometer;
+  Sensor magnetometer;
+
+  private CallbackContext callbackContext;
+
+  /**
+   * Constructor.
+   */
+  public CompassListener() {
+    this.heading = 0;
+    this.timeStamp = 0;
+    this.setStatus(CompassListener.STOPPED);
+  }
+
+  /**
+   * Sets the context of the Command. This can then be used to do things like
+   * get file paths associated with the Activity.
+   *
+   * @param cordova The context of the main Activity.
+   * @param webView The CordovaWebView Cordova is running in.
+   */
+  public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+    super.initialize(cordova, webView);
+    this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE);
+  }
+
+  /**
+   * Executes the request and returns PluginResult.
+   *
+   * @param action            The action to execute.
+   * @param args              JSONArry of arguments for the plugin.
+   * @param callbackS=Context The callback id used when calling back into
+   *                          JavaScript.
+   * @return True if the action was valid.
+   * @throws JSONException
+   */
+  public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+    if (action.equals("start")) {
+      this.start();
+    } else if (action.equals("stop")) {
+      this.stop();
+    } else if (action.equals("getStatus")) {
+      int i = this.getStatus();
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i));
+    } else if (action.equals("getHeading")) {
+      // If not running, then this is an async call, so don't worry about waiting
+      if (this.status != CompassListener.RUNNING) {
+        int r = this.start();
+        if (r == CompassListener.ERROR_FAILED_TO_START) {
+          callbackContext.sendPluginResult(
+              new PluginResult(PluginResult.Status.IO_EXCEPTION, CompassListener.ERROR_FAILED_TO_START));
+          return true;
         }
-        else if (action.equals("getStatus")) {
-            int i = this.getStatus();
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i));
-        }
-        else if (action.equals("getHeading")) {
-            // If not running, then this is an async call, so don't worry about waiting
-            if (this.status != CompassListener.RUNNING) {
-                int r = this.start();
-                if (r == CompassListener.ERROR_FAILED_TO_START) {
-                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, CompassListener.ERROR_FAILED_TO_START));
-                    return true;
-                }
-                // Set a timeout callback on the main thread.
-                Handler handler = new Handler(Looper.getMainLooper());
-                handler.postDelayed(new Runnable() {
-                    public void run() {
-                        CompassListener.this.timeout();
-                    }
-                }, 2000);
-            }
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getCompassHeading()));
-        }
-        else if (action.equals("setTimeout")) {
-            this.setTimeout(args.getLong(0));
-        }
-        else if (action.equals("getTimeout")) {
-            long l = this.getTimeout();
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
-        } else {
-            // Unsupported action
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Called when listener is to be shut down and object is being destroyed.
-     */
-    public void onDestroy() {
-        this.stop();
+        // Set a timeout callback on the main thread.
+        Handler handler = new Handler(Looper.getMainLooper());
+        handler.postDelayed(new Runnable() {
+          public void run() {
+            CompassListener.this.timeout();
+          }
+        }, 2000);
+      }
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getCompassHeading()));
+    } else if (action.equals("setTimeout")) {
+      this.setTimeout(args.getLong(0));
+    } else if (action.equals("getTimeout")) {
+      long l = this.getTimeout();
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
+    } else {
+      // Unsupported action
+      return false;
     }
-
-    /**
-     * Called when app has navigated and JS listeners have been destroyed.
-     */
-    public void onReset() {
-        this.stop();
-    }
-
-    //--------------------------------------------------------------------------
-    // LOCAL METHODS
-    //--------------------------------------------------------------------------
-
-    /**
-     * Start listening for compass sensor.
-     *
-     * @return          status of listener
-     */
-    public int start() {
-
-        // If already starting or running, then just return
-        if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) {
-            return this.status;
-        }
-
-        // Get compass sensor from sensor manager
-        @SuppressWarnings("deprecation")
-        List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION);
-
-        // If found, then register as listener
-        if (list != null && list.size() > 0) {
-            this.mSensor = list.get(0);
-            this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
-            this.lastAccessTime = System.currentTimeMillis();
-            this.setStatus(CompassListener.STARTING);
-        }
-
-        // If error, then set status to error
-        else {
-            this.setStatus(CompassListener.ERROR_FAILED_TO_START);
-        }
-
-        return this.status;
+    return true;
+  }
+
+  /**
+   * Called when listener is to be shut down and object is being destroyed.
+   */
+  public void onDestroy() {
+    this.stop();
+  }
+
+  /**
+   * Called when app has navigated and JS listeners have been destroyed.
+   */
+  public void onReset() {
+    this.stop();
+  }
+
+  // --------------------------------------------------------------------------
+  // LOCAL METHODS
+  // --------------------------------------------------------------------------
+
+  /**
+   * Start listening for compass sensor.
+   *
+   * @return status of listener
+   */
+  public int start() {
+
+    // If already starting or running, then just return
+    if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) {
+      return this.status;
     }
 
-    /**
-     * Stop listening to compass sensor.
-     */
-    public void stop() {
-        if (this.status != CompassListener.STOPPED) {
-            this.sensorManager.unregisterListener(this);
-        }
-        this.setStatus(CompassListener.STOPPED);
+    // MG, use accelerometer & magnetometer

Review Comment:
   ```suggestion
       // use accelerometer & magnetometer
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] mgurzixo commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
mgurzixo commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1230505451

   Ok, got it, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] j2l commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
j2l commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1328100074

   Thanks @mgurzixo 
   Can't make it work, so I'll try to switch to CapacitorJS which updated its motion lib.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] j2l commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
j2l commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1328063215

   Hello!
   Do you know how long we have to wait for device orientation to work?
   Ticket was May 2021, PR is August 2022, we're in November 2022, PR is not reviewed.
   Or please @mgurzixo, could you please provide a way to install your fixed plugin (is it published on NPM?), thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] mgurzixo commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
mgurzixo commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1328098231

   Hello @j2l , I am using [Quasar](https://quasar.dev/), so I donĀ“t know about native cordova, but I suspect that your solution works perfectly :).
   May I suggest you to clone it on github, so that it becomes "your" code that you can patch at will?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] mgurzixo commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
mgurzixo commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1328101280

   I was not able to make Capacitor plugin working (it is horribly complicated...), so I ended up I switching to Cordova plugin, which was a LOT simpler and easier to modify.
   In the worst case, jusr install the official plugin, and replace in  the original compassListener.java with mine in node_modules and android
   Very dirty, but a good stop-gap solution ;)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] mgurzixo commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
mgurzixo commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1230470370

   Hi!
   
   Sounds good, this is my first PR on Github. I fully agree with all the remarks; maybe put an uppercase on "Use ...".
   
   Is there anything I have to do?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] erisu commented on a diff in pull request #78: Rewrite Android native plugin

Posted by GitBox <gi...@apache.org>.
erisu commented on code in PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#discussion_r957390600


##########
src/android/CompassListener.java:
##########
@@ -38,259 +40,306 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.os.Handler;
 import android.os.Looper;
 
+import android.util.Log; // MG
+
 /**
  * This class listens to the compass sensor and stores the latest heading value.
  */
 public class CompassListener extends CordovaPlugin implements SensorEventListener {
 
-    public static int STOPPED = 0;
-    public static int STARTING = 1;
-    public static int RUNNING = 2;
-    public static int ERROR_FAILED_TO_START = 3;
-
-    public long TIMEOUT = 30000;        // Timeout in msec to shut off listener
-
-    int status;                         // status of listener
-    float heading;                      // most recent heading value
-    long timeStamp;                     // time of most recent value
-    long lastAccessTime;                // time the value was last retrieved
-    int accuracy;                       // accuracy of the sensor
-
-    private SensorManager sensorManager;// Sensor manager
-    Sensor mSensor;                     // Compass sensor returned by sensor manager
-
-    private CallbackContext callbackContext;
-
-    /**
-     * Constructor.
-     */
-    public CompassListener() {
-        this.heading = 0;
-        this.timeStamp = 0;
-        this.setStatus(CompassListener.STOPPED);
-    }
-
-    /**
-     * Sets the context of the Command. This can then be used to do things like
-     * get file paths associated with the Activity.
-     *
-     * @param cordova The context of the main Activity.
-     * @param webView The CordovaWebView Cordova is running in.
-     */
-    public void initialize(CordovaInterface cordova, CordovaWebView webView) {
-        super.initialize(cordova, webView);
-        this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE);
-    }
-
-    /**
-     * Executes the request and returns PluginResult.
-     *
-     * @param action                The action to execute.
-     * @param args          	    JSONArry of arguments for the plugin.
-     * @param callbackS=Context     The callback id used when calling back into JavaScript.
-     * @return              	    True if the action was valid.
-     * @throws JSONException 
-     */
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-        if (action.equals("start")) {
-            this.start();
-        }
-        else if (action.equals("stop")) {
-            this.stop();
+  public static int STOPPED = 0;
+  public static int STARTING = 1;
+  public static int RUNNING = 2;
+  public static int ERROR_FAILED_TO_START = 3;
+
+  public long TIMEOUT = 30000; // Timeout in msec to shut off listener
+
+  int status; // status of listener
+  float heading; // most recent heading value
+  long timeStamp; // time of most recent value
+  long lastAccessTime; // time the value was last retrieved
+  int accuracy; // accuracy of the sensor
+
+  private SensorManager sensorManager;// Sensor manager
+  Sensor mSensor; // Compass sensor returned by sensor manager
+
+  Sensor accelerometer;
+  Sensor magnetometer;
+
+  private CallbackContext callbackContext;
+
+  /**
+   * Constructor.
+   */
+  public CompassListener() {
+    this.heading = 0;
+    this.timeStamp = 0;
+    this.setStatus(CompassListener.STOPPED);
+  }
+
+  /**
+   * Sets the context of the Command. This can then be used to do things like
+   * get file paths associated with the Activity.
+   *
+   * @param cordova The context of the main Activity.
+   * @param webView The CordovaWebView Cordova is running in.
+   */
+  public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+    super.initialize(cordova, webView);
+    this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE);
+  }
+
+  /**
+   * Executes the request and returns PluginResult.
+   *
+   * @param action            The action to execute.
+   * @param args              JSONArry of arguments for the plugin.
+   * @param callbackS=Context The callback id used when calling back into
+   *                          JavaScript.
+   * @return True if the action was valid.
+   * @throws JSONException
+   */
+  public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+    if (action.equals("start")) {
+      this.start();
+    } else if (action.equals("stop")) {
+      this.stop();
+    } else if (action.equals("getStatus")) {
+      int i = this.getStatus();
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i));
+    } else if (action.equals("getHeading")) {
+      // If not running, then this is an async call, so don't worry about waiting
+      if (this.status != CompassListener.RUNNING) {
+        int r = this.start();
+        if (r == CompassListener.ERROR_FAILED_TO_START) {
+          callbackContext.sendPluginResult(
+              new PluginResult(PluginResult.Status.IO_EXCEPTION, CompassListener.ERROR_FAILED_TO_START));
+          return true;
         }
-        else if (action.equals("getStatus")) {
-            int i = this.getStatus();
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i));
-        }
-        else if (action.equals("getHeading")) {
-            // If not running, then this is an async call, so don't worry about waiting
-            if (this.status != CompassListener.RUNNING) {
-                int r = this.start();
-                if (r == CompassListener.ERROR_FAILED_TO_START) {
-                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, CompassListener.ERROR_FAILED_TO_START));
-                    return true;
-                }
-                // Set a timeout callback on the main thread.
-                Handler handler = new Handler(Looper.getMainLooper());
-                handler.postDelayed(new Runnable() {
-                    public void run() {
-                        CompassListener.this.timeout();
-                    }
-                }, 2000);
-            }
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getCompassHeading()));
-        }
-        else if (action.equals("setTimeout")) {
-            this.setTimeout(args.getLong(0));
-        }
-        else if (action.equals("getTimeout")) {
-            long l = this.getTimeout();
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
-        } else {
-            // Unsupported action
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Called when listener is to be shut down and object is being destroyed.
-     */
-    public void onDestroy() {
-        this.stop();
+        // Set a timeout callback on the main thread.
+        Handler handler = new Handler(Looper.getMainLooper());
+        handler.postDelayed(new Runnable() {
+          public void run() {
+            CompassListener.this.timeout();
+          }
+        }, 2000);
+      }
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getCompassHeading()));
+    } else if (action.equals("setTimeout")) {
+      this.setTimeout(args.getLong(0));
+    } else if (action.equals("getTimeout")) {
+      long l = this.getTimeout();
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
+    } else {
+      // Unsupported action
+      return false;
     }
-
-    /**
-     * Called when app has navigated and JS listeners have been destroyed.
-     */
-    public void onReset() {
-        this.stop();
-    }
-
-    //--------------------------------------------------------------------------
-    // LOCAL METHODS
-    //--------------------------------------------------------------------------
-
-    /**
-     * Start listening for compass sensor.
-     *
-     * @return          status of listener
-     */
-    public int start() {
-
-        // If already starting or running, then just return
-        if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) {
-            return this.status;
-        }
-
-        // Get compass sensor from sensor manager
-        @SuppressWarnings("deprecation")
-        List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION);
-
-        // If found, then register as listener
-        if (list != null && list.size() > 0) {
-            this.mSensor = list.get(0);
-            this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
-            this.lastAccessTime = System.currentTimeMillis();
-            this.setStatus(CompassListener.STARTING);
-        }
-
-        // If error, then set status to error
-        else {
-            this.setStatus(CompassListener.ERROR_FAILED_TO_START);
-        }
-
-        return this.status;
+    return true;
+  }
+
+  /**
+   * Called when listener is to be shut down and object is being destroyed.
+   */
+  public void onDestroy() {
+    this.stop();
+  }
+
+  /**
+   * Called when app has navigated and JS listeners have been destroyed.
+   */
+  public void onReset() {
+    this.stop();
+  }
+
+  // --------------------------------------------------------------------------
+  // LOCAL METHODS
+  // --------------------------------------------------------------------------
+
+  /**
+   * Start listening for compass sensor.
+   *
+   * @return status of listener
+   */
+  public int start() {
+
+    // If already starting or running, then just return
+    if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) {
+      return this.status;
     }
 
-    /**
-     * Stop listening to compass sensor.
-     */
-    public void stop() {
-        if (this.status != CompassListener.STOPPED) {
-            this.sensorManager.unregisterListener(this);
-        }
-        this.setStatus(CompassListener.STOPPED);
+    // MG, use accelerometer & magnetometer
+    // http://web.archive.org/web/20151205103652/http://www.codingforandroid.com/2011/01/using-orientation-sensors-simple.html
+    // https://android-developers.googleblog.com/2010/09/one-screen-turn-deserves-another.html
+    // https://stackoverflow.com/questions/15537125/inconsistent-orientation-sensor-values-on-android-for-azimuth-yaw-and-roll/16418016#16418016
+    accelerometer = this.sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
+    magnetometer = this.sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
+    if (accelerometer != null || magnetometer != null) {
+      this.sensorManager.registerListener(this, this.magnetometer, SensorManager.SENSOR_DELAY_NORMAL);
+      this.sensorManager.registerListener(this, this.accelerometer, SensorManager.SENSOR_DELAY_NORMAL);
+      this.lastAccessTime = System.currentTimeMillis();
+      this.setStatus(CompassListener.STARTING);
+
+    } else {
+      // If error, then set status to error
+      this.setStatus(CompassListener.ERROR_FAILED_TO_START);
     }
-
-    public void onAccuracyChanged(Sensor sensor, int accuracy) {
-        // TODO Auto-generated method stub
+    return this.status;
+  }
+
+  /**
+   * Stop listening to compass sensor.
+   */
+  public void stop() {
+    if (this.status != CompassListener.STOPPED) {
+      this.sensorManager.unregisterListener(this);
     }
-
-    /**
-     * Called after a delay to time out if the listener has not attached fast enough.
-     */
-    private void timeout() {
-        if (this.status == CompassListener.STARTING) {
-            this.setStatus(CompassListener.ERROR_FAILED_TO_START);
-            if (this.callbackContext != null) {
-                this.callbackContext.error("Compass listener failed to start.");
-            }
-        }
+    this.setStatus(CompassListener.STOPPED);
+  }
+
+  public void onAccuracyChanged(Sensor sensor, int accuracy) {
+    // TODO Auto-generated method stub
+  }
+
+  /**
+   * Called after a delay to time out if the listener has not attached fast
+   * enough.
+   */
+  private void timeout() {
+    if (this.status == CompassListener.STARTING) {
+      this.setStatus(CompassListener.ERROR_FAILED_TO_START);
+      if (this.callbackContext != null) {
+        this.callbackContext.error("Compass listener failed to start.");
+      }
     }
-
-    /**
-     * Sensor listener event.
-     *
-     * @param SensorEvent event
-     */
-    public void onSensorChanged(SensorEvent event) {
-
-        // We only care about the orientation as far as it refers to Magnetic North
-        float heading = event.values[0];
-
-        // Save heading
-        this.timeStamp = System.currentTimeMillis();
-        this.heading = heading;
-        this.setStatus(CompassListener.RUNNING);
-
-        // If heading hasn't been read for TIMEOUT time, then turn off compass sensor to save power
-        if ((this.timeStamp - this.lastAccessTime) > this.TIMEOUT) {
-            this.stop();
+  }
+
+  private float gravity[] = null;
+  private float magnetic[] = null;
+
+  private float toDeg(float x) {
+    return x * 180 / (float) Math.PI; // Convert to degrees
+  }
+
+  /**
+   * Sensor listener event.
+   *
+   * @param SensorEvent event
+   */
+  @SuppressWarnings("deprecation")
+  public void onSensorChanged(SensorEvent event) {
+    float alpha = (float) 0.5; // low pass filter;
+    float heading = (0f / 0f); // NaN
+    switch (event.sensor.getType()) {
+      case Sensor.TYPE_ACCELEROMETER:
+        // Isolate the force of gravity with the low-pass filter.
+        if (gravity == null) {
+          gravity = new float[3];
         }
+        gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
+        gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
+        gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];
+        break;
+      case Sensor.TYPE_MAGNETIC_FIELD:
+        magnetic = event.values;
+        break;
     }
-
-    /**
-     * Get status of compass sensor.
-     *
-     * @return          status
-     */
-    public int getStatus() {
-        return this.status;
-    }
-
-    /**
-     * Get the most recent compass heading.
-     *
-     * @return          heading
-     */
-    public float getHeading() {
-        this.lastAccessTime = System.currentTimeMillis();
-        return this.heading;
+    if (isNaN(heading) && gravity != null && magnetic != null) {
+      float R[] = new float[9];
+      float I[] = new float[9];
+      boolean success = SensorManager.getRotationMatrix(R, I, gravity, magnetic);
+      if (success) {
+        // Android recommands using SensorManager.getOrientation() but it has a wontFix
+        // bug:
+        // https://stackoverflow.com/questions/67824884/pitch-returned-by-getorientation-function-is-wrong
+        // So we use Stochastically's method:
+        // https://stackoverflow.com/questions/15537125/inconsistent-orientation-sensor-values-on-android-for-azimuth-yaw-and-roll/16418016#16418016
+        // which works like a charm.
+        // Beware also of screen orientation:
+        // https://android-developers.googleblog.com/2010/09/one-screen-turn-deserves-another.html
+
+        heading = (float) Math.atan2((double) (R[1] - R[3]), (double) (R[0] + R[4]));
+        heading = toDeg(heading);
+        // Log.v("MGMG", "heading: " + heading);

Review Comment:
   Remove



##########
src/android/CompassListener.java:
##########
@@ -38,259 +40,306 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.os.Handler;
 import android.os.Looper;
 
+import android.util.Log; // MG
+
 /**
  * This class listens to the compass sensor and stores the latest heading value.
  */
 public class CompassListener extends CordovaPlugin implements SensorEventListener {
 
-    public static int STOPPED = 0;
-    public static int STARTING = 1;
-    public static int RUNNING = 2;
-    public static int ERROR_FAILED_TO_START = 3;
-
-    public long TIMEOUT = 30000;        // Timeout in msec to shut off listener
-
-    int status;                         // status of listener
-    float heading;                      // most recent heading value
-    long timeStamp;                     // time of most recent value
-    long lastAccessTime;                // time the value was last retrieved
-    int accuracy;                       // accuracy of the sensor
-
-    private SensorManager sensorManager;// Sensor manager
-    Sensor mSensor;                     // Compass sensor returned by sensor manager
-
-    private CallbackContext callbackContext;
-
-    /**
-     * Constructor.
-     */
-    public CompassListener() {
-        this.heading = 0;
-        this.timeStamp = 0;
-        this.setStatus(CompassListener.STOPPED);
-    }
-
-    /**
-     * Sets the context of the Command. This can then be used to do things like
-     * get file paths associated with the Activity.
-     *
-     * @param cordova The context of the main Activity.
-     * @param webView The CordovaWebView Cordova is running in.
-     */
-    public void initialize(CordovaInterface cordova, CordovaWebView webView) {
-        super.initialize(cordova, webView);
-        this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE);
-    }
-
-    /**
-     * Executes the request and returns PluginResult.
-     *
-     * @param action                The action to execute.
-     * @param args          	    JSONArry of arguments for the plugin.
-     * @param callbackS=Context     The callback id used when calling back into JavaScript.
-     * @return              	    True if the action was valid.
-     * @throws JSONException 
-     */
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-        if (action.equals("start")) {
-            this.start();
-        }
-        else if (action.equals("stop")) {
-            this.stop();
+  public static int STOPPED = 0;
+  public static int STARTING = 1;
+  public static int RUNNING = 2;
+  public static int ERROR_FAILED_TO_START = 3;
+
+  public long TIMEOUT = 30000; // Timeout in msec to shut off listener
+
+  int status; // status of listener
+  float heading; // most recent heading value
+  long timeStamp; // time of most recent value
+  long lastAccessTime; // time the value was last retrieved
+  int accuracy; // accuracy of the sensor
+
+  private SensorManager sensorManager;// Sensor manager
+  Sensor mSensor; // Compass sensor returned by sensor manager
+
+  Sensor accelerometer;
+  Sensor magnetometer;
+
+  private CallbackContext callbackContext;
+
+  /**
+   * Constructor.
+   */
+  public CompassListener() {
+    this.heading = 0;
+    this.timeStamp = 0;
+    this.setStatus(CompassListener.STOPPED);
+  }
+
+  /**
+   * Sets the context of the Command. This can then be used to do things like
+   * get file paths associated with the Activity.
+   *
+   * @param cordova The context of the main Activity.
+   * @param webView The CordovaWebView Cordova is running in.
+   */
+  public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+    super.initialize(cordova, webView);
+    this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE);
+  }
+
+  /**
+   * Executes the request and returns PluginResult.
+   *
+   * @param action            The action to execute.
+   * @param args              JSONArry of arguments for the plugin.
+   * @param callbackS=Context The callback id used when calling back into
+   *                          JavaScript.
+   * @return True if the action was valid.
+   * @throws JSONException
+   */
+  public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+    if (action.equals("start")) {
+      this.start();
+    } else if (action.equals("stop")) {
+      this.stop();
+    } else if (action.equals("getStatus")) {
+      int i = this.getStatus();
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i));
+    } else if (action.equals("getHeading")) {
+      // If not running, then this is an async call, so don't worry about waiting
+      if (this.status != CompassListener.RUNNING) {
+        int r = this.start();
+        if (r == CompassListener.ERROR_FAILED_TO_START) {
+          callbackContext.sendPluginResult(
+              new PluginResult(PluginResult.Status.IO_EXCEPTION, CompassListener.ERROR_FAILED_TO_START));
+          return true;
         }
-        else if (action.equals("getStatus")) {
-            int i = this.getStatus();
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i));
-        }
-        else if (action.equals("getHeading")) {
-            // If not running, then this is an async call, so don't worry about waiting
-            if (this.status != CompassListener.RUNNING) {
-                int r = this.start();
-                if (r == CompassListener.ERROR_FAILED_TO_START) {
-                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, CompassListener.ERROR_FAILED_TO_START));
-                    return true;
-                }
-                // Set a timeout callback on the main thread.
-                Handler handler = new Handler(Looper.getMainLooper());
-                handler.postDelayed(new Runnable() {
-                    public void run() {
-                        CompassListener.this.timeout();
-                    }
-                }, 2000);
-            }
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getCompassHeading()));
-        }
-        else if (action.equals("setTimeout")) {
-            this.setTimeout(args.getLong(0));
-        }
-        else if (action.equals("getTimeout")) {
-            long l = this.getTimeout();
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
-        } else {
-            // Unsupported action
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Called when listener is to be shut down and object is being destroyed.
-     */
-    public void onDestroy() {
-        this.stop();
+        // Set a timeout callback on the main thread.
+        Handler handler = new Handler(Looper.getMainLooper());
+        handler.postDelayed(new Runnable() {
+          public void run() {
+            CompassListener.this.timeout();
+          }
+        }, 2000);
+      }
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getCompassHeading()));
+    } else if (action.equals("setTimeout")) {
+      this.setTimeout(args.getLong(0));
+    } else if (action.equals("getTimeout")) {
+      long l = this.getTimeout();
+      callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
+    } else {
+      // Unsupported action
+      return false;
     }
-
-    /**
-     * Called when app has navigated and JS listeners have been destroyed.
-     */
-    public void onReset() {
-        this.stop();
-    }
-
-    //--------------------------------------------------------------------------
-    // LOCAL METHODS
-    //--------------------------------------------------------------------------
-
-    /**
-     * Start listening for compass sensor.
-     *
-     * @return          status of listener
-     */
-    public int start() {
-
-        // If already starting or running, then just return
-        if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) {
-            return this.status;
-        }
-
-        // Get compass sensor from sensor manager
-        @SuppressWarnings("deprecation")
-        List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION);
-
-        // If found, then register as listener
-        if (list != null && list.size() > 0) {
-            this.mSensor = list.get(0);
-            this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
-            this.lastAccessTime = System.currentTimeMillis();
-            this.setStatus(CompassListener.STARTING);
-        }
-
-        // If error, then set status to error
-        else {
-            this.setStatus(CompassListener.ERROR_FAILED_TO_START);
-        }
-
-        return this.status;
+    return true;
+  }
+
+  /**
+   * Called when listener is to be shut down and object is being destroyed.
+   */
+  public void onDestroy() {
+    this.stop();
+  }
+
+  /**
+   * Called when app has navigated and JS listeners have been destroyed.
+   */
+  public void onReset() {
+    this.stop();
+  }
+
+  // --------------------------------------------------------------------------
+  // LOCAL METHODS
+  // --------------------------------------------------------------------------
+
+  /**
+   * Start listening for compass sensor.
+   *
+   * @return status of listener
+   */
+  public int start() {
+
+    // If already starting or running, then just return
+    if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) {
+      return this.status;
     }
 
-    /**
-     * Stop listening to compass sensor.
-     */
-    public void stop() {
-        if (this.status != CompassListener.STOPPED) {
-            this.sensorManager.unregisterListener(this);
-        }
-        this.setStatus(CompassListener.STOPPED);
+    // MG, use accelerometer & magnetometer
+    // http://web.archive.org/web/20151205103652/http://www.codingforandroid.com/2011/01/using-orientation-sensors-simple.html
+    // https://android-developers.googleblog.com/2010/09/one-screen-turn-deserves-another.html
+    // https://stackoverflow.com/questions/15537125/inconsistent-orientation-sensor-values-on-android-for-azimuth-yaw-and-roll/16418016#16418016
+    accelerometer = this.sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
+    magnetometer = this.sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
+    if (accelerometer != null || magnetometer != null) {
+      this.sensorManager.registerListener(this, this.magnetometer, SensorManager.SENSOR_DELAY_NORMAL);
+      this.sensorManager.registerListener(this, this.accelerometer, SensorManager.SENSOR_DELAY_NORMAL);
+      this.lastAccessTime = System.currentTimeMillis();
+      this.setStatus(CompassListener.STARTING);
+
+    } else {
+      // If error, then set status to error
+      this.setStatus(CompassListener.ERROR_FAILED_TO_START);
     }
-
-    public void onAccuracyChanged(Sensor sensor, int accuracy) {
-        // TODO Auto-generated method stub
+    return this.status;
+  }
+
+  /**
+   * Stop listening to compass sensor.
+   */
+  public void stop() {
+    if (this.status != CompassListener.STOPPED) {
+      this.sensorManager.unregisterListener(this);
     }
-
-    /**
-     * Called after a delay to time out if the listener has not attached fast enough.
-     */
-    private void timeout() {
-        if (this.status == CompassListener.STARTING) {
-            this.setStatus(CompassListener.ERROR_FAILED_TO_START);
-            if (this.callbackContext != null) {
-                this.callbackContext.error("Compass listener failed to start.");
-            }
-        }
+    this.setStatus(CompassListener.STOPPED);
+  }
+
+  public void onAccuracyChanged(Sensor sensor, int accuracy) {
+    // TODO Auto-generated method stub
+  }
+
+  /**
+   * Called after a delay to time out if the listener has not attached fast
+   * enough.
+   */
+  private void timeout() {
+    if (this.status == CompassListener.STARTING) {
+      this.setStatus(CompassListener.ERROR_FAILED_TO_START);
+      if (this.callbackContext != null) {
+        this.callbackContext.error("Compass listener failed to start.");
+      }
     }
-
-    /**
-     * Sensor listener event.
-     *
-     * @param SensorEvent event
-     */
-    public void onSensorChanged(SensorEvent event) {
-
-        // We only care about the orientation as far as it refers to Magnetic North
-        float heading = event.values[0];
-
-        // Save heading
-        this.timeStamp = System.currentTimeMillis();
-        this.heading = heading;
-        this.setStatus(CompassListener.RUNNING);
-
-        // If heading hasn't been read for TIMEOUT time, then turn off compass sensor to save power
-        if ((this.timeStamp - this.lastAccessTime) > this.TIMEOUT) {
-            this.stop();
+  }
+
+  private float gravity[] = null;
+  private float magnetic[] = null;
+
+  private float toDeg(float x) {
+    return x * 180 / (float) Math.PI; // Convert to degrees
+  }
+
+  /**
+   * Sensor listener event.
+   *
+   * @param SensorEvent event
+   */
+  @SuppressWarnings("deprecation")
+  public void onSensorChanged(SensorEvent event) {
+    float alpha = (float) 0.5; // low pass filter;
+    float heading = (0f / 0f); // NaN
+    switch (event.sensor.getType()) {
+      case Sensor.TYPE_ACCELEROMETER:
+        // Isolate the force of gravity with the low-pass filter.
+        if (gravity == null) {
+          gravity = new float[3];
         }
+        gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
+        gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
+        gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];
+        break;
+      case Sensor.TYPE_MAGNETIC_FIELD:
+        magnetic = event.values;
+        break;
     }
-
-    /**
-     * Get status of compass sensor.
-     *
-     * @return          status
-     */
-    public int getStatus() {
-        return this.status;
-    }
-
-    /**
-     * Get the most recent compass heading.
-     *
-     * @return          heading
-     */
-    public float getHeading() {
-        this.lastAccessTime = System.currentTimeMillis();
-        return this.heading;
+    if (isNaN(heading) && gravity != null && magnetic != null) {
+      float R[] = new float[9];
+      float I[] = new float[9];
+      boolean success = SensorManager.getRotationMatrix(R, I, gravity, magnetic);
+      if (success) {
+        // Android recommands using SensorManager.getOrientation() but it has a wontFix

Review Comment:
   ```suggestion
           // Android recommends using SensorManager.getOrientation() but it has a wontFix
   ```



##########
src/android/CompassListener.java:
##########
@@ -38,259 +40,306 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.os.Handler;
 import android.os.Looper;
 
+import android.util.Log; // MG

Review Comment:
   This can be replaced with Apache Cordova's Logger.
   
   ```suggestion
   import org.apache.cordova.LOG;
   ```
   
   Also create a log tag for the `CompassListener` class. E.g.:
   
   ```java
   private static final String LOG_TAG = "CompassListener";
   ```
   
   Usage example after making those changes:
   
   ```java
   LOG.d(LOG_TAG, "Some message here");
   ```
   
   Since you also removed/commented out the only log line
   
   ```
   // Log.v("MGMG", "heading: " + heading);
   ```
   
   Technically you can remove the commented out line and import completely since your not logging anything at all..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] breautek commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
breautek commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1230481555

   Welcome to pull requests!
   
   > Is there anything I have to do?
   
   Github will keep track of all commits done to your branch that initiated the PR (in this case, your master branch). So if you make more commits, it will appear here allowing reviewers to see and respond to updates. So all you need to do (if you're willing of course) is to make a new commit to your branch that includes the recommended changes.
   
   If you have any questions or concerns about a particular recommendation, feel free to ask by commenting.
   
   >  maybe put an uppercase on "Use ...".
   
   I'm sure Erisu will accept that, so feel free to capitalise on the first letter for all sentences in comments ;)
   
   In future pull requests, I'd recommend creating a branch for your changes to make a pull request from, but don't worry that for this pull request. You'll just have to make sure you don't commit anything to your master branch if it's not intended to be included in this pull request.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] mgurzixo closed pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
mgurzixo closed pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] breautek commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
breautek commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1230615264

   We'll keep the PR open because changes will have to be reviewed again and eventually merged in by a maintainer.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [cordova-plugin-device-orientation] mgurzixo commented on pull request #78: feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD

Posted by GitBox <gi...@apache.org>.
mgurzixo commented on PR #78:
URL: https://github.com/apache/cordova-plugin-device-orientation/pull/78#issuecomment-1232682101

   Sorry, my mistake!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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