Top Ad unit 728 × 90

Google’s Sleep API helps developers build better sleep tracking apps

Google has introduced a new Sleep API that developers can use to surface information about a user’s sleep, resulting in more advanced sleep tracking apps. The Sleep API is available now as part of the latest version of Google Play Services.

According to Google, the Sleep API is a “simple API that centralizes sleep detection processing in a battery-efficient manner.” It’s part of Google’s Android Activity Recognition API, which can be used to detect a user’s activities like if they’re biking or walking.

“So much of what we do relies on a good night’s rest,” Google said. “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.”

The Sleep API will use an on-device machine learning model to infer the user’s sleep state based on input from your phone’s light and motion sensors. Google said its new API will save developers from having to spend time developing their own methods to determine when a user has started or ended sleep. In addition, using Google’s API has other advantages over other sleep tracking APIs, including needing less power to use and offering more reliability in data collection. The latter is especially important as Google Play Services is less affected by Doze and other battery management services than third-party apps.

Once information is collected, it’s reported in two ways:

  1. A ‘sleep confidence’, which is reported at a regular interval (up to 10 minutes)
  2. A daily sleep segment which is reported after a wakeup is detected

In its blog post, Google highlights an app called Sleep as Android that uses the new Sleep API. The app can track things like sleep duration, regularity, phases, snoring, and more, with less power and more reliability than before thanks to switching over to the Sleep API. “Sleep Duration is one of the most important parameters to watch for ensuring a good night’s rest,” the Sleep as Android team said. “The new Sleep API gives us a fantastic opportunity to track it automatically in the most battery efficient way imaginable.”

(As an aside, the Sleep as Android team created the DontKillMyApp website to highlight how aggressive OEM power management services kept killing their app’s sleep tracking services.)

Third-party apps use Google’s new Sleep API today but will be required to prompt the user to grant the ACTIVITY_RECOGNITION permission. This ensures that users will have control over which apps can track their sleep. Interested developers can learn more about the Sleep API by checking out Google’s API Documentation.

The post Google’s Sleep API helps developers build better sleep tracking apps appeared first on xda-developers.



from xda-developers https://ift.tt/2P8V4fr
via IFTTT
Google’s Sleep API helps developers build better sleep tracking apps Reviewed by site on 4:28 PM Rating: 5

No comments:

All Rights Reserved by XDA © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.