I'm not sure this is happening, but I ran into a similar problem with the accelerometer. It will not give any sensor readings when the screen is locked. So what I did when I want the sensor readings, I just locked the call block every 5 minutes, so the screen turns on, and then I get the sensor readings. Should be useful for you. The user does not need to do anything manually.
source share