Sleep tracking on Android is about to get a lot better with Google's new Sleep API
What you need to know
- Google is making its Sleep API publicly available.
- The API is used to power features like Bedtime mode in Google's Clock app.
- Developers can now use the Sleep API as part of the latest Google Play Services.
Google has decided to make its Sleep API publicly available to help Android users stay informed about their sleep and allow developers to create great sleep tracking apps that have minimal impact on battery life. Most developers currently use detection algorithms that are inconsistent between apps. When multiple apps check for changes in user activity independently and continuously, your phone's battery drains faster than usual.
Nick Grayson, Product Manager at Google, wrote in a blog post:
The Sleep API is part of the Android Activity Recognition API, and generates information about the user's sleep. It utilizes an on-device AI model that relies on the phone's light and motion sensors as inputs to collect sleep information. The API reports the sleeping information to apps in two ways: a 'sleep confidence' at regular intervals of up to 10 minutes and a daily sleep segment reported after it detects a wakeup.
The first third-party app to use the Sleep API is Urbandroid's Sleep As Android. It is worth noting, however, that apps won't be able to detect sleep unless you grant the Physical Activity Recognition runtime permission. In the coming weeks, you can expect many more popular sleep tracking apps to start using the Sleep API.
Be an expert in 5 minutes
Get the latest news from Android Central, your trusted companion in the world of Android