Android apps that have to run in the background like sleep-trackers have had a rough time. Among other things, they suffer inconsistent and unreliable background app limitations across different Android versions, which can interfere with how the apps work at a very fundamental level. This doesn't fix that issue, but today Google is rolling out a specific API just for those apps, letting them pull sleep duration data right from the system itself.

The API is built into the existing Activity Recognition suite, which (if you allow it) can automatically pick up on the things you're doing based on the device sensors. That's how things like Google Fit can determine whether you're biking, walking, or driving when it comes to tracking physical activity. Google already uses the Sleep API internally for the Google Clock's bedtime mode.

So what does this change mean for you — isn't an API some technical thing you as an end-user don't need to worry about? Well, it may actually have a measurable impact with some benefits, but it depends on how your favorite sleep tracker worked before.

See, previously, these sleep-tracking apps have had to run their own detection algorithms, watching device sensors with their own trained models and triggers to try to estimate when you're sleeping.That means they're running continuously in the background to do those things. Like I said earlier, some smartphone makers adjust Android itself in a way that outright breaks this behavior, and Google has already said it won't really do anything to fix that. But this API means they won't have to anymore; it's all just built right in. But, there is a catch. I'm told by Urbandroid's Petr Nalevka that this new API only addresses one of the metrics that these apps gather, as it only lets them track sleep duration. So most sleep trackers will still need to do other stuff continuously in the background anyway.

It also means sleep-tracking apps may make less of a dent in your battery life going forward. If Play Services is already doing all this stuff in the background, having an app running in the background and doing the same things in parallel is redundant and wastes power. This can be is simpler and more efficient – but, again, the new API only addresses one of the potential metrics to be tracked, so the difference will be small.

It remains to be seen how Google's new Sleep API will actually perform in practice. Many of these sleep-tracking apps consider their detection methods something of a trade secret, often an advertised benefit that their app has over someone else's. Still, I'm optimistic that Google's API should deliver high-quality data to developers. And while it's not as bit a change as we may have hoped for, it may still make a measurable impact.

UPDATE: 2021/02/26 6:30am PST BY RYNE HAGER

Urbandroid's Petr Nalevka provided us with additional context regarding this change. Sadly, it won't make much of a dent in background app management unless sleep trackers are only gathering a single metric (sleep duration). Our coverage has been updated with this information.

Source: Google