I've uploaded B4A Java library with Java source and B4A example project with source.
The library sends the compass heading for which the phone is pointing.
See this thread:
https://www.b4x.com/android/forum/threads/phone-as-compass.83890/#post-532028
I used the sensor type TYPE_ROTATION_VECTOR rather than the usual TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD.
Barry.
The library sends the compass heading for which the phone is pointing.
See this thread:
https://www.b4x.com/android/forum/threads/phone-as-compass.83890/#post-532028
I used the sensor type TYPE_ROTATION_VECTOR rather than the usual TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD.
Barry.