B4A Library Phone as Compass Java library


Well-Known Member
Licensed User
Longtime User
You can use this sensor with PhoneSensors from the Phone library.

Set the sensor type to 11.

Note that it is only available in Android 5+.

That's a good point. I always forget to check for the API level for functions.

If an API function requires Android 5+, the proper thing to do in B4A would be to set Min SDK Level to 21 in the Manifest Editor?

My current default tester phones are all Android 5.01+. I dragged out an older phone which is Android 4.4. My example app worked. Looking at the Android documentation again I see the LocationManager stuff I use requires Android SDK level 2 or 3 or so, and the SensorManager TYPE_ROTATION_VECTOR requires Android SDK level 9 (Android version 2.3).


Looking at my test app in the Manifest Editor, I have android:minSdkVersion="5".

I should probably set android:minSdkVersion to 9?

Last edited: