Technical
How App Standby Buckets Limit Background TWAs
September 29, 2026 · 8 min read
Operating systems on mobile devices must balance user experience with battery life. On Android, this balance is managed through a power management system known as App Standby Buckets. Introduced by Google to curb background resource consumption, this system group apps based on how recently and how frequently they are used. For developers who convert their Progressive Web Apps into Android apps using a Trusted Web Activity, understanding these standby buckets is crucial. Because a TWA relies on a web engine running inside a native wrapper, background tasks such as service worker updates, web push notifications, and background synchronisation are heavily impacted by these resource allocations.
Understanding Android App Standby Buckets
Android dynamically assigns every installed app to one of five priority standby buckets. The operating system monitors user interaction patterns and assigns the app to a bucket that determines how much system resource, CPU time, and network access the app can consume when it is not actively running in the foreground. The resource restrictions become progressively tighter as you move down the bucket hierarchy.
| Bucket Name | Usage Frequency | System Resource Access | Background Job Delay |
|---|---|---|---|
| Active | App is currently in use or was used very recently | Full access, no background restrictions | No delay |
| Working Set | App is used regularly but not currently active | Mild restrictions, occasional background deferrals | Minimal delay |
| Frequent | App is used every few days | Moderate restrictions, limited network access windows | Up to several hours |
| Rare | App is rarely used, perhaps once a week or less | Strict restrictions, highly limited background execution | Up to 24 hours |
| Restricted | App exhibits abnormal behaviour or is virtually never used | Extreme restrictions, almost no background activity allowed | Indefinite or blocked |
When an app is placed in a lower priority bucket such as Rare or Restricted, the Android system limits the frequency of alarms, delays background jobs initiated by the JobScheduler, and restricts the app from accessing the high-speed network. For standard native apps, this means delayed sync tasks. For TWAs, it has direct consequences on the underlying service worker.
How Standby Buckets Impact TWA Web Engines
A Trusted Web Activity operates using a lightweight native Android wrapper package that communicates with a host browser, usually Google Chrome or another system-level Chromium engine. When Android assigns a standby bucket, it applies the restriction rules directly to the native wrapper package name. However, because the wrapper depends on the web engine to execute JavaScript, the standby bucket status of the wrapper directly controls how the host browser is allowed to allocate runtime memory and CPU cycles to your service worker.
When your TWA falls into the Rare or Restricted bucket, several critical web platform APIs face strict operating limits:
- Service Worker Execution: The system browser will terminate idle service worker threads much faster to preserve memory. Wake ups triggered by events are heavily throttled.
- Periodic Background Sync: This API relies on the OS to awaken the service worker at defined intervals. If the app is in the Rare bucket, these sync events may be delayed by 24 hours or completely ignored by the browser engine.
- Background Fetch API: Large resource downloads initiated while the TWA is in the background will be paused indefinitely until the app returns to a higher priority bucket or the device is connected to a power source.
- IndexedDB Persistence: While data stored in IndexedDB is not deleted when an app is downgraded to a lower bucket, the browser may restrict the database write speeds to save battery cycles.
The Effect on Web Push Notifications
One of the most common questions developers face is why push notifications appear delayed or fail to arrive when a TWA has not been opened for several days. This issue is directly tied to App Standby Buckets. Web push notifications are delivered to a TWA using Firebase Cloud Messaging or a similar push service, which wakes up the browser engine to trigger the service worker's push event listener.
When a TWA is in the Active or Working Set bucket, push events are processed instantly. However, once the TWA enters the Rare or Restricted bucket, the operating system limits the number of high-priority messages that can wake up the app. If you send standard-priority push notifications to a TWA in the Rare bucket, Android will batch these notifications and deliver them only during system-defined maintenance windows, which might occur only once or twice a day.
To mitigate this, developers must ensure that critical notifications are flagged with high priority at the protocol level. However, abuse of high-priority messages without displaying a visible notification can result in the Android system forcing the TWA wrapper directly into the Restricted bucket, compounding the issue.
How to Keep Your TWA in an Active Standby Bucket
The easiest way to prevent background restrictions is to encourage user interactions that naturally keep the app in the Active or Working Set buckets. Android automatically elevates an app to the Active bucket when specific trigger conditions are met:
- The user launches the TWA from the home screen or app drawer.
- The user interacts with a visible notification delivered by the app.
- The app performs a system-level task that uses a foreground service, such as playing audio or tracking location with active user permission.
- The user shares content to the app using the Web Share Target API.
By designing engaging features, such as deep-linking notifications that lead to useful content or integrating native-like media controls during audio playback, you naturally prompt the user behavior required to maintain a high-priority standby status.
Testing Standby Buckets Locally Using ADB
Developers do not need to wait weeks for an app to naturally drift into a lower standby bucket to test how their offline sync, service workers, and push systems handle constraints. The Android Debug Bridge allows you to manually force your TWA into any standby bucket for testing purposes.
To inspect the current standby bucket of your installed TWA wrapper, connect your test device or emulator and run the following command in your terminal:
adb shell am get-standby-bucket your.package.name
The output will return an integer value indicating the active bucket. The standard mapping values are:
- 10: Active
- 20: Working Set
- 30: Frequent
- 40: Rare
- 45: Restricted
To force your TWA into the Rare bucket to observe how your background sync behaves, execute the following command:
adb shell am set-standby-bucket your.package.name rare
With the app placed in the Rare bucket, you can trigger a push notification or test your offline storage mechanisms to ensure that your service worker handles the delayed execution gracefully. Using these testing patterns ensures that your production users do not suffer from broken background states when their device enters aggressive power-saving modes.
Ready to ship your Android app?
Paste your PWA URL, get a signed APK and a Google Play ready AAB in minutes.
Build my app