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.”
Author: Abner Li
Source: 9TO5Google