Users of a personal-budgeting phone app who open it only on payday, or force-quit it, find imports and backups weeks stale; why, and how should the app catch up?
answer
- rarely opened means rarely run
- the tier shrinks after days unused
- a force-quit is not a promise
- last-success times, not schedules
- catch up after the first frame
basics
~20 sThe OS rations background time by use, so rarely opened apps get few runs, and a force-quit may halt scheduled work until the next open. Record each duty's last success and catch up, in priority order, when the app opens.
solid answer
~50 sBackground time follows use. On one platform the OS places each app in a priority tier by how recently and often it is opened; a rarely used app gets, as a documented guideline, about ten minutes of jobs a day and loses network access while on battery, and after a set number of days unused it falls to a tier that runs jobs once a day for up to ten minutes, batched with other apps. On the other platform the system decides when to run the task and promises nothing. What a force-quit does to scheduled work is not the same everywhere, so the design assumes nothing runs until the next open. The app therefore stores a last-success time per duty — import, model refresh, backup — and on open shows the data's age, runs the overdue import after the first frame, and asks the user about a backup weeks overdue.
code
pseudocode · 10 lineson_app_foreground():
render_home(local_balances, age = now() - last_success("import"))
after_first_frame:
if now() - last_success("import") > 6 hours:
run_import_in_foreground()
if now() - last_success("model") > 3 days:
schedule("model_refresh", requires = [charging, idle])
if now() - last_success("backup") > 14 days:
show_prompt("Last backup " + days_since("backup") + " days ago. Back up now?")
rearm_all_schedules()go deeper
Remember that an app people rarely open gets less background time, and that after a force-quit you should not assume scheduled work keeps running.
Explain how recent and frequent use sets an app's ration of background jobs on one platform, and why charging changes it.
Design the catch-up: last-success times per duty, data age shown at once, overdue work ordered after the first frame, and an overdue backup surfaced to the user.
Weigh which duties may rely on the device at all for occasional users, and which must move to the server or into a visible user action.
## Two users the schedule never reaches The personal-budgeting app has two kinds of users whose overnight import, model refresh and backup quietly stop: people who open it only on payday, and people who swipe or force-quit it out of habit. Both expose the same truth — a device schedule is a request the OS weighs against how much the user values the app. ## Background time follows use On one platform the OS places every app in a **usage-priority tier** by how recently and how often the user opens it, and each tier gets a different ration of background jobs while the device is on battery. Its documented guideline values (approximate, not guaranteed, and subject to change) include: | Tier (by use) | Ordinary jobs | Network for jobs | |---|---|---| | In active use | up to 20 minutes per rolling hour | unrestricted | | Used regularly | up to 10 minutes per rolling 4 hours | unrestricted | | Used, not daily | up to 10 minutes per rolling 12 hours | unrestricted | | Rarely used | up to 10 minutes per rolling 24 hours | disabled | | Most restricted | once a day, up to 10 minutes, batched with other apps | disabled | On that platform's recent releases an app the user has not interacted with for a set number of days (eight) can be moved to the most restricted tier, where its jobs run only alongside other apps' jobs. Charging lifts the tier limits for every tier except the most restricted, which only loosens when the phone is charging, idle and on an unmetered network. Each device maker may also use its own criteria for tiering. The other platform's documentation says the system decides the best time to launch a task and states no usage rule — so the design assumes the same shape: an app people rarely open gets little background time. For the payday user, the arithmetic is stark: with network access disabled on battery in the rarely used tier, the import can run only while the phone charges; a user who seldom charges it overnight may see no import at all between paydays. ## A force-quit is not something to build on What a user's force-quit or force-stop does to scheduled background work is not the same on every platform or device, and a design cannot count on either outcome. The safe assumption is that **nothing scheduled runs until the user opens the app again**. (What a swipe-away cancels for a running upload or download belongs to the questions on those transfer queues.) ## Catching up on the next open The fix is to stop treating the schedule as the source of truth and to keep a **last-success time** for each duty instead. 1. **Record outcomes, not intentions.** Each duty writes its last successful completion time when it finishes. 2. **Show age immediately.** The first screen renders local balances with "updated 3 weeks ago" — the import is not allowed to delay the first frame (the launch path is its own question). 3. **Run overdue duties in priority order** just after the first frame, while the app is in the foreground and not rationed: the import first, because the user is looking at balances; the model refresh rescheduled for the next charge, because categorisation is merely less accurate; the backup surfaced to the user. 4. **Make long-overdue risk visible.** A backup three weeks old is a data-loss risk a person should decide about: a quiet prompt ("last backup 23 days ago — back up now?") beats a silent failure. 5. **Re-arm the schedules**, so the next run is requested again with its conditions. ## What not to do - **Game the tier.** Sending notifications only to earn "active" status annoys users, who can then block them, and one platform's documentation warns not to try to manipulate tiering at all. - **Hold the process alive in the background** with an ongoing task the user did not ask for. - **Assume the server knows.** For the budget alert, the server already has the transactions and sends the push itself; the device's catch-up exists for on-device duties. ## What interviewers grade That the candidate links background time to use, keeps the specific tiers attributed to one platform, refuses to promise anything after a force-quit, and designs a catch-up driven by recorded outcomes.
- On a platform that lets users exempt an app from its battery restrictions, should the app ask payday users to do so?Rarely. The prompt is aimed at apps whose core function needs it; a budgeting app is not one, the user gains little, and the app still has to handle the case where they decline. Recording last-success times and catching up on open works for everyone, exempt or not.
- How would you measure how stale data is for rarely-opened users?At each app open, report the age of every duty's last success and the user's days since previous open. Segmenting the ages by that gap shows directly how much the schedule helps people who open the app rarely, and whether the catch-up keeps the first screen honest.
- A scheduled job runs just as often whether the user opens the app daily or monthly.
- After a force-quit, every platform keeps running the app's scheduled work as normal.
- Catch-up work should finish before the first screen appears.
- Sending regular notifications is a sound way to keep background time.
- If the job was scheduled, the backup must be recent.