Skip to content Skip to sidebar Skip to footer

Accelerometer Onsensorchanged Not Called When Screen Is Off

I have a background service which is running all the times and collects sensor data. But when the screen dims, it stops collecting the data. I want it to collect even in this case.

Solution 1:

This is a documented issue: http://code.google.com/p/android/issues/detail?id=3708

Unfortunately no easy fix exists and the workarounds also don't always work. It seems to be fixed in Android 2.3.3 for most (if not all) devices though.

Solution 2:

try this in oncreate method getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); this works in my app

Post a Comment for "Accelerometer Onsensorchanged Not Called When Screen Is Off"