Skip to content Skip to sidebar Skip to footer

SensorEventListener Not Unregistering Itself

I have been developing an application which needs to perform accelerometer calibration in several steps. What I have done, is create a SensorEventListener that gets a certain amoun

Solution 1:

If your SensorEventListener only gets called once after you've unregistered it then this behaviour is probably due to a race condition, due to the multi-threaded nature of Android. So if you want to shut off processing the readings, then (as you suggest) you should set a boolean variable and test it with if statements to ensure no further processing once you've reached your limit.


Post a Comment for "SensorEventListener Not Unregistering Itself"