'Sub Process_Globals:
Dim OrientationSensor As PhoneSensors
'Sub Activity_Create:
If FirstTime Then _
OrientationSensor.Initialize2(OrientationSensor.TYPE_ORIENTATION, 2)
'Sub Activity_Resume:
OrientationSensor.StartListening("OrientationSensor")
'Sub Activity_Pause:
OrientationSensor.StopListening
'Sub OrientationSensor_SensorChanged(Values() As Float):
Dim NewOrientation As Int
NewOrientation = Round(Values(0))
'...