Still unsure of what your trying to do , but this might be of some help.
* Check inclusion of Phone lib ...
B4X:
Sub Process_Globals
Dim ps As PhoneSensors
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
ps.Initialize(ps.TYPE_PROXIMITY)
ps.StartListening("ps")
End If
End Sub
Sub ps_SensorChanged (Values() As Float)
Log(Values(0))
If Values(0) = 0 Then
Log("Player has hand over phone ..")
Else
Log("Player has removed hand ..")
End If
End Sub
Make sure to call ... ps.StopListening somewhere in your app when finished.