Skip to main content

Google launches Android Sleep API to detect snoozing, waking up; available to apps now

Android has long offered an Activity Recognition API that processes device sensor data with machine learning models in a battery-efficient manner. Google is now offering an Android Sleep API to allow for the creation of more wellness apps.

So much of what we do relies on a good night’s rest. Our phones have become great tools for making more informed decisions about our sleep. And by being informed about sleep habits, people can make better decisions throughout the day about sleep, which affects things like concentration and mental health.

Part of the broader Android Activity Recognition API, Google’s new Sleep API analyze your phone’s light and motion sensors with an on-device AI model to generate two pieces of information:

  • A “sleep confidence,” which is reported at a regular interval (up to 10 minutes)
  • A daily sleep segment, which is reported after a wakeup is detected

In offering this new tool, Google wants to save developers from having to “spend valuable engineering time to combine sensor signals to determine when the user has started or ended activities like sleep,” noting how:

These detection algorithms are inconsistent between apps and when multiple apps independently and continuously check for changes in user activity, battery life suffers.

End users will have to grant the Physical Activity Recognition runtime permission before apps can get access to this data.

Google touts features similar to the Bedtime mode in Android’s Clock app and partnered with the Sleep As Android app for today’s launch:

The new Sleep API gives us a fantastic opportunity to track it automatically in the most battery efficient way imaginable.

Sleep As Android developers

Available with the latest version of Google Play Services on Android 10 and later, the Sleep API can be used by developers now. Looking forward, Google is “working more on this API and in this area in the future.”

FTC: We use income earning auto affiliate links. More.

You’re reading 9to5Google — experts who break news about Google and its surrounding ecosystem, day after day. Be sure to check out our homepage for all the latest news, and follow 9to5Google on Twitter, Facebook, and LinkedIn to stay in the loop. Don’t know where to start? Check out our exclusive stories, reviews, how-tos, and subscribe to our YouTube channel

Comments

Author

Avatar for Abner Li Abner Li

Editor-in-chief. Interested in the minutiae of Google and Alphabet. Tips/talk: abner@9to5g.com