Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

My app stops working when the phone screen is off

Short answer

Android deliberately pauses or delays background work to save battery. When a phone sits idle with the screen off, the system suspends network access and defers jobs, and an app that is not built for this looks as if it stopped. The fix is choosing the right background method, not only restarting the app.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • Uploads or syncs stop when I lock the phone.
  • The app works while open but misses things when it is in the background.
  • Reminders and timers fire late or not at all.
  • It worked on older phones and fails on newer ones.
  • Different users report different results on different phone brands.

Why does this happen?

  1. Doze suspends network access and jobs

    When a device is unplugged, still and has its screen off, Android enters Doze. In Doze the system suspends network access, ignores wake locks and defers jobs, syncs and standard alarms until a short maintenance window.

  2. App Standby limits apps the user has not opened lately

    The system treats an app as idle when the user has not used it for a while, and then it defers the app's background network activity.

  3. The wrong tool was used for the task

    Android documents different tools for different jobs: simple async work stops when the app leaves the screen, WorkManager suits work that must continue, and foreground services suit work that must not be interrupted. Using the wrong one makes the app fail only in the background.

  4. Long tasks get interrupted

    Android's guidance says a background task that takes longer than 10 minutes is highly likely to be interrupted, and should be split into smaller parts or moved to a foreground service.

What can I do about it today?

  1. Find which feature stopsIs it uploads, location, messages or a timer? Different features need different fixes, so name the one that matters most.
  2. Note what the phone was doingScreen off, plugged in or not, how long it sat idle. Doze depends on exactly these conditions.
  3. Test with the app openRun the same action with the app on screen. If it works there, the problem is background handling, not your server.
  4. Do not tell users to change battery settings yetAsking many users to change power settings can cause new problems, and Google Play restricts apps that ask for battery exemptions without a core need.
  5. Send examples to your developerPhone brand, Android version, the time it should have happened and the time it did.

When should I bring someone in?

  • The missing background work affects orders, payments or customer messages.
  • The problem is only reported on some phone brands.
  • Your developer says it is just how Android works and offers no plan.

How do I handle it?

  1. Identify the task typeI sort each background feature into the kind Android documents for it: quick, deferrable, long-running or event-driven.
  2. Choose the supported methodI use the platform's recommended tool for each, and a push message where your server should wake the app instead of the app polling.
  3. Test under idle conditionsI test with the screen off and the device idle, using the platform's own idle test commands.
  4. Agree on user-visible behaviourWhere a notification must be shown for continuous work, I explain this to you first so it does not surprise your users.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Is this a bug in my app or just Android?

Both can be true. Android limits background work by design, but a well built app plans for those limits using the supported tools.

Will an iPhone behave the same way?

iOS has its own background rules. This page covers Android, and an iPhone problem needs its own check.

Can the app just ask to be exempt from battery limits?

Google's guidance says Play policies prohibit requesting direct exemption unless the core function of the app is adversely affected, so it is not a general fix.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.