StealThis .dev

TWA — Trusted Web Activity (PWA to Play Store)

Wrap any PWA as a native Android app using Trusted Web Activities and Bubblewrap CLI. Publish to Google Play Store without writing Java/Kotlin.

Open in Lab
android pwa
Targets: HTML

Code

Trusted Web Activities let you publish any PWA to the Google Play Store as a native Android app. No Java, no Kotlin — just your existing web app wrapped in a Chrome Custom Tab without the browser UI.

What is a TWA?

A Trusted Web Activity is an Android activity that launches a full-screen Chrome Custom Tab. When Digital Asset Links verification passes, the browser chrome (address bar, toolbar) is completely hidden, making it look and feel like a native app.

Requirements:

  • A PWA with a valid web app manifest
  • HTTPS hosting
  • Android SDK (for building the APK/AAB)

Setup with Bubblewrap CLI

Bubblewrap (2.9k stars) is Google Chrome Labs’ CLI that generates a complete Android project from your PWA manifest.

1. Install Bubblewrap

npm i -g @bubblewrap/cli

2. Initialize from your PWA manifest

bubblewrap init --manifest=https://your-pwa.com/manifest.webmanifest

This prompts for your signing key, package name, and launcher icon, then generates a full Android project.

3. Build the APK

bubblewrap build

Outputs app-release-signed.apk and app-release-bundle.aab (for Play Store upload).

Generated Project Structure

app/
  src/main/
    AndroidManifest.xml
    res/
      mipmap-*/        # Launcher icons (auto-generated)
      values/
        strings.xml
gradle/
build.gradle
twa-manifest.json      # Bubblewrap config (re-run init to update)

For the browser chrome to disappear, you must prove you own the domain. Place this file at https://your-pwa.com/.well-known/assetlinks.json:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.your.package",
    "sha256_cert_fingerprints": ["AA:BB:CC:..."]
  }
}]

Get your signing key fingerprint with:

keytool -list -v -keystore your-keystore.jks

The Full Flow

  1. Build your PWA — manifest, service worker, HTTPS
  2. bubblewrap init — generate Android project from manifest
  3. bubblewrap build — produce signed APK/AAB
  4. Deploy assetlinks.json — verify domain ownership
  5. Upload to Play Store — publish the AAB via Google Play Console

References