Sleep tracking is an increasingly popular health trend that mobile app developers have been building applications to support. To simplify this endeavor and improve device performance, Google has added a new Android Sleep API that operates as an extension of its existing Activity Recognition API.
The algorithms that are used to process device data and determine when a user is sleeping vary wildly from app to app. As this functionality has been added to more and more applications, Android device performance has been negatively impacted by multiple systems all trying to determine the same thing. To solve this problem Google has introduced the new Android Sleep API, which will allow multiple applications to reference the same data set.
The API announcement summarized this problem:
“Developers spend valuable engineering time to combine sensor signals to determine when the user has started or ended activities like sleep. These detection algorithms are inconsistent between apps and when multiple apps independently and continuously check for changes in user activity, battery life suffers.”
Google has published documentation specific to this new resource.