I’ve lost count of how many nights I’ve put on a YouTube video in bed, closed my eyes for just a second, and woken up with zero clue what I just watched. Autoplay will happily entertain an audience of absolutely nobody while I’m knocked out cold, leaving my phone dangerously low on battery by morning.
YouTube does have a built-in sleep timer, but it’s basically a guessing game. How am I supposed to know how long I’ll stay awake? So I downloaded SleepGuard, an Android app that takes a pretty strict, no-nonsense approach to bedtime viewing.
I gave my phone permission to call it a night
A dead man’s switch has found a new occupation
SleepGuard is a free, open-source Android app that takes its cues from a rather unlikely place. The developer borrowed the concept from a railway safety mechanism that requires train drivers to confirm they’re still alert at regular intervals. If you miss a check-in, the train automatically stops. SleepGuard applies the same principle to your phone by locking its screen.
You can grab SleepGuard through F-Droid, one of several alternatives to the Google Play Store. It works on Android 8.0 and up, and the quick setup walks you right through the permissions you’ll need to turn on:
- Install and open SleepGuard, then pick your language and Video mode.
- Turn on Display over other apps so its confirmation button can pop up on top of your videos.
- Activate its device administrator permission so SleepGuard can lock your phone.
- Allow exact alarms and exempt SleepGuard from battery optimization to keep its check-ins running on schedule.
- Enable notifications when prompted.
Once you’re through the onboarding, the main screen presents the controls you’ll use each night. You can choose how often SleepGuard checks on you, how many seconds you have to respond, and where the confirmation button appears. Adjust those settings, tap Start, and jump back into whatever you were watching. Since you activate SleepGuard manually, you won’t have to deal with its check-ins during your regular daytime viewing.
A tiny red circle gets the final say
My bedtime entertainment now has attendance checks
While you’re watching a video, SleepGuard pops a small red circle onto your screen at whatever time interval you picked. Tap it to confirm you’re still awake, and the circle vanishes until the next check-in. If the countdown runs out without a response, SleepGuard locks your phone.
On my Galaxy S24 Ultra, I set the interval to five minutes and gave myself 15 seconds to respond. The red circle appeared while I was watching an Instagram Reel, and when I deliberately let the countdown expire, my phone locked as expected. SleepGuard handles the entire process in the background, so you can leave its interface behind and open whichever video app you prefer. That also means you won’t have to scrub through half an episode the following morning to figure out where you dozed off.
You should experiment with both timing settings to find a rhythm that suits your viewing habits. With a five-minute interval and a 15-second response window, your video could continue playing for up to five minutes and 15 seconds after you drift off, depending on when you last tapped the button. Checking in every minute could turn a relaxing evening documentary into a vigilance exercise, while stretching the interval to half an hour could let autoplay run for far too long. Five minutes is my sweet spot, but I understand your tolerance for tapping the screen might be different.
You also get eight options for positioning the red circle around the edges and corners of your screen. If it gets in the way of subtitles, playback controls, or Instagram’s like and comment buttons, you can relocate it to a less intrusive spot.
If the red circle stops appearing on schedule, check your phone’s background battery settings. On Samsung phones, head to Settings > Apps > SleepGuard > Battery and select Unrestricted if the option is available.
SleepGuard bases its entire judgment of whether you’re awake on your ability to tap a button. It has no way of monitoring your eyes, breathing, or body movements, so leaving your phone on the couch while you raid the fridge could trigger a screen lock, too. What happens next also depends on the app you’re using. Locking your phone will usually stop video playback, although services with background playback, such as YouTube Premium, may continue playing audio. It’s a good idea to test SleepGuard with your favorite streaming app before relying on it overnight.
There’s a bedtime setting for the audio crowd
Podcasts can have a curfew without the pop quiz
SleepGuard also comes with an Audio mode for music, podcasts, and audiobooks. Select the mode, set your preferred duration, and tap Start. The app stops playback when the countdown expires, even with the screen off. After all, having to open your eyes every few minutes to tap a red circle would somewhat sabotage your efforts to fall asleep.
You can switch between Video and Audio modes from the main screen, and SleepGuard keeps a persistent notification with a Stop button within easy reach. Whenever you’re done watching or listening, you can end the session straight from your notification shade.
SleepGuard falls into my favorite category of open-source Android apps that solve a particular annoyance with minimal baggage. It’s free of ads and trackers, doesn’t require an account, and doesn’t even request Android’s internet permission. Its entire source code is also available on GitHub.
At least somebody knows when the show’s over
I’ve no intention of giving up the occasional video before bed. Some nights I’ll stay awake long enough to finish it; others, the credits will roll without me. SleepGuard gives my phone a reasonable way to recognize when I’ve abandoned the proceedings, even if its judgment can be a little impatient. My bedtime viewing habits still need work, but autoplay has finally acquired a curfew.