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-unsubscr...@cordova.apache.org

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


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

Reply via email to