Automatic sleep tracking - Sleep as Android

Automatic start after fall asleep is a breakthrough method invented by Urbandroid which uses Google’s Activity Transition API as a base to detect when you’ve gone to bed to start sleep tracking.


This is a companion discussion topic for the original entry at https://docs.sleep.urbandroid.org//sleep/automatic_sleep_tracking.html

My screen stay on when automatic sleep tracking is enabled, im not sure if its a problem with my phone or the app.

I have the problem of the app automatically turning my volume gradually off.

How do I disable this behaviour?

I want my volume to stay at the level that I set it.

In the lullabies section of the settings make sure the option “Turn off when Sleeping” is unchecked.

1 Like

Done. Hope it works! Thank you for the pointer…

The latest update made the automatic sleep tracking not work for me. It’s not sensitive enough to detect that I’m sleeping.

Hi, can someone explain what is the “sleep time estimate” option for and how does it work? I have trouble understanding it.
Today, my sleep monitoring ended 3 hours before I was awake and I believe that it might be related.
I’m using Amazfit Band 5 for sleep tracking and “Notify & Fitness” app showed my sleep time just fine. Wearables settings in SAA are OK, it sees heart rate, so it surely communicate with the band.
I have the band from 3 days and today was the first day that this situation happened. On weekdays I wake up 7-8AM, but on weekends I sleep till 10-11AM. Today (Saturday), I was sleeping till 10 AM, but the sleep tracking in SAA ended on 7:10 AM. The “sleep time estimate” option was set to “save automatically”. Might it be related? Thanks :slight_smile:

EDIT: I found something about it on old documentation page:

"Settings > Sleep tracking > Sleep time estimate

Sleep time estimate uses Google Activity Transition API to check when you have most probably been asleep. No direct sleep tracking occurs with Sleep time estimate, so you’ll only get sleep duration tracked.

Every day when you didn’t track your sleep, you’ll receive a notification with a sleep time estimate.

You can configure the feature to just notify you with the Add action or make the app save sleep automatically to your sleep history."

So, I mostly understand that setting now. But am I right, that since I’ve got automatic sleep tracking option enabled, sleep time estimate should be disabled/overridden by auto sleep tracking?

Add the possibility to turn off the sonar while band is tracking. I have pets, so I think is more a curate to use only the band.

Hello @Jake_Val at the moment the a only tracks sleep activity either using the Wearable or using the in-phone sensor like Sonar…

1 Like

Where can I find the option for the new tracking mechanism of Sleep API in Google Play services?
(mentioned here: https://android-developers.googleblog.com/2021/02/low-power-sleep-tracking-on-android.html)

Hello @oasisfeng, e already have this mechanism in production for several years, but the new API makes it more battery efficient…

This feature is available in Settings > Sleep tracking > Sleep time estimate which is default on… if you do not track your sleep the app will show you an estimate in the morning with the option to add to your data…

If you want to use the new Google API for this you need to install the latest BETA version of the app, and you need to wait till your phone gets the new Play Service with the Sleep API support… otherwise the app will fallback to our activity recognition based solution…

2 Likes

Welp, just created a new post about it, should have read your reply first :smiley:

Cancel previous message, just got back in the Beta program :slight_smile:

Thanks for your detailed explanation.

If I understand correctly, “Sleep time estimate” will take advantage of SleepSegmentEvent if Sleep API is rolled out to my device.

Will Sleep as Android use SleepClassifyEvent to get rid of “wake lock” during the sleep tracking to reduce power consumption significantly?

I think the new Sleep API in Google Play services is implemented in CHRE (Context Hub Runtime Environment) if CHRE is supported on the device. That will not hold “wake lock” itself.

Hi Petr, does setting this to “smart period” also disable Wear OS tracking until the smart period? I’m having high battery drain at night and want to mitigate it.

Question: why sonar tracking do not stops after the alarm is “accepted” by me? I’ve already found the not slipping sheep :sheep: but sonar continue to work draining the battery… Why?

Hello Yuriy,
alarms have by default “Terminate tracking” enabled. Could you please check if this is still ticked in the settings for this alarm? You can find it almost at the bottom of the menu in per-alarms settings

I’m sleep tracking the manual. But my phone still starts tracking every time I plug it in to charge it pixel 7 Pro

Hello Dave, are you using Phaser? Is the automatic tracking start for Phaser enabled in Settings → Services → Smart light → Phaser section → Start automatically?