-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(android)!: rewrite native code to replace TYPE_ORIENTATION w/ TYPE_ACCELEROMETER & TYPE_MAGNETIC_FIELD #78
base: master
Are you sure you want to change the base?
Conversation
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? |
Welcome to pull requests!
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.
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. |
Co-authored-by: エリス <[email protected]>
Co-authored-by: エリス <[email protected]>
Co-authored-by: エリス <[email protected]>
Ok, got it, thanks! |
We'll keep the PR open because changes will have to be reviewed again and eventually merged in by a maintainer, which I believe is still the intention. Do correct me if I'm wrong. |
Sorry, my mistake! |
Hello! |
Thanks @mgurzixo |
I was not able to make Capacitor plugin working (it is horribly complicated...), so I ended up switching to Cordova plugin, which was a LOT simpler and easier to modify. |
Platforms affected
Android
Motivation and Context
On Android, the plugin used a Sensor.TYPE_ORIENTATION which is deprecated. This sensor was more and more #64 in new devices. So now the plugin uses Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD which are available everywhere. They are fused together as instructed here, except that the SensorManager.getOrientation() has a bug that will not be fixed. Stochastically found a solution that works like a charm and is used here.
Increasing reports of compass not working on some android devices
Description
rewrote
src/android/CompassListener.java
Testing
tested on poco X3 NFC, OnePlus2, OnePlus6 & Samsung SM-T590.
Checklist