Wake locks, wakeup sensors, and the FIFO queue

All Android applications run on a dedicated Application Processor (AP), which is a part of the main CPU of the phone. This application processor is designed in such a way that it goes into the suspended mode when the user is not interacting with the phone. In this suspended mode, it reduces the power consumption by 10 times or more, but this freezes all the applications in the background. To work around this problem, the Android platform provides a solution using wake locks. If an application has to perform some important operation in the background and doesn't want the application processor to go into suspended mode, then it has to request a wake lock from the system's power service. Once the important ...

Get Android Sensor Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.