This is not related to the programming language.
I do not agree. I try to explain why :
1) there are many apps that measure the inclination of a surface on which it must rest smartphone; they are so-called "spirit level" or "bubble level";
2) work correctly on both my smartphone and provide more than reliable results;
3) probably using the sensor "Orientation" and not the "Accelerometer";
4) almost certainly developed in Java.
I found that the same code (which reads the "Orientation" sensor) works perfectly on a Motorola Defy Plus and does not work on an Asus Zenfone 2.
Unless interpret this as due to different version of Android (2.3 and 5.1) it seems to assume it is a software issue of the language used.
Definitely not the hardware.
If, however, you use the "Accelerometer" sensor will have some very big mistakes (even 10-12 degrees) with both devices, and these errors are not constant in the 0-90 degree range that interests me.
To derive the inclination by an accelerometer value I followed some guidelines found on this forum that simply suggested to multiply the Y value for the coefficient of gravity (9.81 ca).
This is not valid for any of the 2 devices. From all this I infer that the "Accelerometer" sensor is not suitable for measuring inclinations and you must use the "Orientation" sensor.
This seems to me only logical given their name and saw that the first analyzes a dynamic and the second a static situation.
Sorry to see that, after many years of good use of B4A language, I must unfortunately note that it has found its limits: it is not operated the important hardware of any particular device.