Repository navigation
[expo-location][android] Use modern heading sensor when available #49700
melvi-l
started this conversation in
Proposals and Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We are currently developing a compass-like application.
After multiple tests and sketchy fixes, we figured out that the current
.watchHeadingAsync()is underperforming compared to what is possible with a really simple native Android module that just forwards the native Sensor.TYPE_ROTATION_VECTOR or Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR.The current version uses
TYPE_MAGNETIC_FIELD+TYPE_ACCELEROMETERraw sensors, with a manual sensor fusion, then throttles the update to 2deg and 50ms.I was wondering if there is a reason for all this hassle or if this is just legacy?
From what I get, Expo's purpose is to offer a unified facade to the underlying platform APIs. I propose to use Sensor.TYPE_ROTATION_VECTOR or Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR, either chosen by a flag (like useGyroscope: boolean) or automatically selected based on availability.
It would be a pleasure to help by providing a pull request if a maintainer agrees to mentor me in this matter.
Thank you for your work,
Let me know if I can help in any way.
PS: Sorry if any part of my message seems offensive; English is not my first language.
All reactions