hemanthrajv / flutter_compass

MIT License
101 stars 170 forks source link

Not working on Huawei RIO-L02 with Android 5.1 #39

Closed postacik closed 3 years ago

postacik commented 4 years ago

Hi, The library (v0.4.3) works fine on new devices but when I try to run it on a Huawei RIO-L02 with Android 5.1, it does not work.

this.sensorManager.getDefaultSensor(sensorType) function returns null with both of the following sensor types:

Sensor.TYPE_ROTATION_VECTOR and Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR

However the following compass implemention which uses Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD sensors to calculate the azimuth work without any problems on the same device:

https://github.com/iutinvg/compass/blob/48347d7ab23f1bf1801791d561fb5ae452217046/app/src/main/java/com/sevencrayons/compass/Compass.java

Is it possible to add this alternative as a fallback method in the library?

ebjerkelund commented 3 years ago

+1 on this one. Doesn't work on my Samsung 5.1.1

paulosousadias commented 3 years ago

+1 also. Doesn't work on some phones because it lacks Sensor.TYPE_ROTATION_VECTOR and Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR. But it has the Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD which works for example on https://pub.dev/packages/simple_flutter_compass (which is not maintained and why trying to use this one.