weekends are for leisure

Android accelerometer, getting a wake lock while phone is asleep

Tags: #Android  #Programming  #Gps 

There’s a quirk with Android that renders a partial wake lock useless if you want to poll the accelerometer while the screen is off. The workaround is to acquire a screen-dim + acquire-causes-wakeup wake lock. The screen turns on while you’re polling, but that’s the only solution I’ve found.

I’ve implemented the workaround in my GPSing project. Hopefully this won’t cause a drastic change in battery usage.