Android Sleep API to make sleep tracking apps more efficient

JC Torres - Feb 25, 2021, 7:19pm CST
Android Sleep API to make sleep tracking apps more efficient

There has been perhaps an overabundance of focus on activity trackers, most of them targeting, well, activities. While movement and exercise are, of course, important, they aren’t the only measures of a healthy lifestyle. Sleep is just as important, perhaps even more so these days. In an effort to help app developers and, consequently, users develop better sleeping habits, Google is launching its new Sleep API to empower better low-power sleep tracking on all Android devices.

There are already a handful of sleep tracking apps on Android that may sound almost too little, too late for this Sleep API. All those apps, however, use their own detection algorithms and strategies to determine whether a user is sleeping or has woken up. At the very least, these apps need to run in the background in order to work.

There are, of course, drawbacks to this method. For one, phones take a significant battery hit when an app’s process continuously runs in the background, forcing some to always plug their phones in during the night. But even with that workaround, OEMs use different methods and policies when killing background apps, leading to unreliable and inconsistent sleep tracking anyway.

The Sleep API, in contrast, is part of Android’s wider Activity Recognition API. This means it is baked into Google Play Services and provides a standard and power-efficient framework for tracking sleep. The Sleep API was developed in collaboration with the developers of the popular Sleep As Android alarm app, who also happen to be the people behind the “Don’t Kill My App” website.

For end users, this means that sleep tracking apps can become more battery-friendly and more consistent, giving them better insights into their sleep patterns and offer better sleep-related features. As part of the Activity Recognition API, users will still need to give their permission for the Physical Activity Recognition before this comes into effect.


Must Read Bits & Bytes