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
"Sensor orientation is not available" for some Android devices #452
Comments
I had to solve it in the native Android module, that is the patch that worked for me using the accelerometer sensor.
|
hi, I use your document in my project, but it report a error |
This is a showstopper bug for us, it causes the app to crash with a fatal exception:
This is from a real device Samsung S6 Lite tablet |
how install react-native-sensors+7.3.6.patch? |
Describe the bug
Orientation is not available for devices that do not have some sensors. e.g. a device with only accelerometer will return "Sensor orientation is not available" error when subscribing to "orientation".
Tested setup:
Samsung Galaxy A04s with accelerometer but no gyroscope or magnetometer.
Working without error on Samsung Galaxy S8 and iPhone XR.
To Reproduce
Steps to reproduce the behavior:
Take phone with accelerometer but no gyroscope nor magnetometer (e.g. Samsung A20).
This will return
Sensor orientation is not available
Expected behavior
The package should check what sensors are available to make the orientation measurements. I suspect that some sensor fusion is happening under the surface, but the module should check internally what sensors are available for the fusion. In case of single sensor, an orientation estimate, be it noisy, should still be returned. It's up to the end user to decide how to deal with noisy sensor data.
Desktop
The text was updated successfully, but these errors were encountered: