Google announced a new expansion to Android’s ‘Activity Recognition API’ that specifically targets sleep monitoring capabilities.
Called the ‘Sleep API,’ Google is rolling it out to Android 10 and up via Google Play Services. The API offers tools for developers to track and monitor sleep in a more battery-efficient manner.
Specifically, the Sleep API uses on-device artificial intelligence (AI) to analyze a smartphone’s light and motion sensors. The analysis can generate two pieces of information: a sleep confidence metric and a daily sleep segment.
The API reports the sleep confidence at 10-minute intervals while the daily sleep segment is reported when the API detects a wake-up.
Google pointed out that it already uses the Sleep API in some apps, but it’s now publicly available for other developers to use. In a blog post about the Sleep API, Google mentioned the ‘Bedtime mode‘ in its Clock app as an example of features the Sleep API can enable.
Benefits of using the Sleep API include a more consistent reporting experience across apps (apps can pull from one system-level reporting system instead of building and employing their own versions). Additionally, allowing apps to plug into one API for sleep features can improve battery life.
Developers curious to learn more can check out the full Sleep API blog post here.
Source: Google Via: 9to5Google