Tracking your sleeping patterns with wearable devices can be easy and convenient, but not much can be said about tracking your sleep on Android smartphones as it can drain your battery life. Well, that is about to change with Google Sleep API.
Tech giant Google has announced that it is making its Sleep API publicly available. The company says it is an Android Activity Recognition API that surfaces information about the user’s sleep. It can also be used to power features like the Bedtime mode clock. The API also uses an on-device artificial intelligence model that uses the device’s light and motion sensors as inputs.
The Sleep API will be built right into Google Play Services and the app will need to be granted Physical Activity Recognition runtime permission from the user to detect sleep. The sleeping information will then be reported in two ways, one being at a regular interval (up to 10 minutes) and the other being a daily sleep segment which is reported after a wakeup is detected.
Google says while developers spend valuable engineering time to combine sensor signals to determine when the user has started or ended activities like sleep, the detection made by algorithms can be inconsistent between apps and more especially when multiple apps independently and continuously check for changes in user activity, battery life suffers.
“The Sleep API is a simple API that centralizes sleep detection processing in a battery-efficient manner. For this launch, we are proud to collaborate with Urbandroid, the developer of the popular alarm app, Sleep As Android,” said Nick Grayson, Product Manager at Google.