PWAs on Chrome and Android (WebAPK, TWA)
In one line: Chrome on Android is the most capable PWA platform — an installable PWA fires
beforeinstallprompt, and when the user installs, Chrome silently mints a WebAPK so the app
gets a real package on the launcher, its own icon, and OS-level integration. For app-store
presence, the same web app can be wrapped in a Trusted Web Activity (TWA) and shipped to
Google Play.
Installing through Chrome
Section titled “Installing through Chrome”beforeinstallprompt. When your app meets the installability criteria (HTTPS, a valid manifest with name/icons/start_url, a service worker with a fetch handler), Chrome firesbeforeinstallprompt. CallpreventDefault()to stash the event, then triggerprompt()from your own install button at a moment that makes sense.- In-browser install UI. Chrome also surfaces an install entry point in the omnibox/menu, so users can install without your custom button.
appinstalledevent. Fires once the install completes — a good hook to hide your install affordance and record the conversion.
let deferredPrompt = null;window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault(); // suppress the mini-infobar deferredPrompt = e; // save for your own button showInstallButton();});
installButton.addEventListener('click', async () => { if (!deferredPrompt) return; deferredPrompt.prompt(); await deferredPrompt.userChoice; deferredPrompt = null; // can only be used once});WebAPK — a real Android package
Section titled “WebAPK — a real Android package”When a user installs a qualifying PWA, Chrome requests a WebAPK from a Google-operated minting service and installs it on the device. This gives the PWA properties a bookmark shortcut never has:
- First-class app identity. Its own entry in the app drawer, app-info screen, and long-press shortcuts; it shows up as an installed Android app.
- Manifest-driven appearance. Name, icons (including maskable), theme color, display mode,
and
scopecome from your manifest. - Intent handling. The WebAPK registers for your origin, so links into your scope can open in the installed app instead of a browser tab.
- No Play Store needed. WebAPK installation happens entirely through Chrome — no developer account, signing, or store listing required.
Trusted Web Activity — shipping to Play
Section titled “Trusted Web Activity — shipping to Play”A TWA runs your PWA full-screen, chromeless, inside an Android app you publish to Google Play. Unlike a WebView, a TWA renders in the user’s Chrome with full web-platform capabilities and shared storage.
- Digital Asset Links verify ownership. You host an
assetlinks.jsonthat ties your app’s signing key to your origin; without it the TWA shows a URL bar. - Tooling. Bubblewrap (CLI) and PWABuilder generate the TWA wrapper project from your manifest and handle the Asset Links wiring.
- Play billing. Distributing through Play means complying with Play policy; in-app digital goods generally require Play Billing.
Decision framework
Section titled “Decision framework”| Decision question | Recommended action | Rationale |
|---|---|---|
| Do I need the Play Store to install? | No — WebAPK installs straight from Chrome. | Only store distribution needs a TWA + Play listing. |
When do I call prompt()? |
After saving beforeinstallprompt, from a user action. |
The event is one-shot and must be triggered by a gesture. |
| How do I get a Play listing? | Wrap the PWA in a TWA with Bubblewrap/PWABuilder. | A TWA reuses your web app and passes web capabilities through. |
| Why does my TWA show a URL bar? | Fix Digital Asset Links (assetlinks.json). |
Ownership verification failed; the bar appears until it passes. |
| Icons look cropped on the launcher? | Provide a maskable icon. |
Android applies a mask; non-maskable icons get clipped. |
Practical checklist
Section titled “Practical checklist”- Meet installability criteria: HTTPS, valid manifest, service worker with a fetch handler.
- Provide maskable icons so the WebAPK launcher icon renders correctly.
- Handle
beforeinstallprompt(stash + custom button) andappinstalled. - Set
scopeandstart_urlso the WebAPK captures the right links. - For Play distribution, generate a TWA with Bubblewrap or PWABuilder.
- Host
assetlinks.jsonand verify Digital Asset Links so no URL bar shows. - Use Play Billing for in-app digital goods to stay within Play policy.
- Test install, launcher identity, and link capture on a real Android device.