I've a broadcast receiver for phone state changes, and when phone state is "OFFHOOK", I register an eventlistener for proximity sensor. When the proximity changes , I do something(I do the registering and the 'something' in a service ,for that matters). So far everything works as expected. The problem is that screen is not getting locked when the proximity value is 'CLOSE'. I think this is because my listener is catching the proximity change event and so the phone's default application ain't getting the event. Is there a way to pass on the event, like 'return false' in onClickListener() of buttons.
edit:
Codes
In the oncreate of the service
myProximitySensor = mySensorManager
.getDefaultSensor(Sensor.TYPE_PROXIMITY);
mySensorManager.registerListener(this, myProximitySensor,
SensorManager.SENSOR_DELAY_NORMAL);
I implemented the SensorEventListener, and in it's onSensorChanged() method:
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audioManager.setSpeakerphoneOn(true);