The technology around tracking our sleep and its various parameters has become quite advanced in recent times with the advent of smartphones, smartwatches and fitness trackers. Google is now introducing a new API in Android that will allow apps to better recognize when the user is sleeping, along with its related data.
The API, called Sleep API, will take inputs from the device’s light and motion sensors, and use on-device AI models to collect data in two ways. These are:
- 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
Of course, to collect all this data Android will need permission from the user, namely the Physical Activity Recognition runtime permission. Once granted, apps will be able to utilize this information for their functionalities.
To showcase the capabilities of this new API, Google collaborated with Urbanandroid, to develop an app based around this new API called Sleep as Android. The app can track sleep duration, regularity, phases, snoring, and more.