Which device are you using? Most devices do not have a gyroscope sensor.
You can read about the sensors here: Motion Sensors | Android Developers
I think that you need to use the orientation sensor instead of the gyroscope.
Sub Process_Globals
Dim Accelerometer As PhoneAccelerometer
End Sub
Sub Globals
Dim lblAngle As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
lblAngle.Initialize("")
lblAngle.TextSize = 20
Activity.AddView(lblAngle, 40%x, 45%y, 20%x, 30dip)
End If
End Sub
Sub Activity_Resume
Accelerometer.StartListening("Accelerometer")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Accelerometer.StopListening
End Sub
Sub Accelerometer_AccelerometerChanged (X As Float, Y As Float, Z As Float)
lblAngle.Text = "Angle = " & Round(ATan2D(Y, X))
End Sub
The accelerometer can do that. Hold your device like a steering wheel and this will show the angle it's tilted.
B4X:Sub Process_Globals Dim Accelerometer As PhoneAccelerometer End Sub Sub Globals Dim lblAngle As Label End Sub Sub Activity_Create(FirstTime As Boolean) If FirstTime Then lblAngle.Initialize("") lblAngle.TextSize = 20 Activity.AddView(lblAngle, 40%x, 45%y, 20%x, 30dip) End If End Sub Sub Activity_Resume Accelerometer.StartListening("Accelerometer") End Sub Sub Activity_Pause (UserClosed As Boolean) Accelerometer.StopListening End Sub Sub Accelerometer_AccelerometerChanged (X As Float, Y As Float, Z As Float) lblAngle.Text = "Angle = " & Round(ATan2D(Y, X)) End Sub