Android Integration v2.0.0

Deploy your P.E.Y.E.K web applications into native Android environments. We support two primary methods: TWA (Trusted Web Activity) for the Play Store path, and WebView for deep native integration.

Trusted Web Activity (TWA)

TWA is the recommended way to wrap your PWA for the Google Play Store. It uses a specialized mode of Chrome to run your web app with zero native code.

1. Initialize Project

npx @bubblewrap/cli init --manifest https://peyek.pcode.my.id/manifest.json

2. Build signed Bundle

npx @bubblewrap/cli build

3. Digital Asset Links

Deploy your assetlinks.json to https://yourdomain.com/.well-known/assetlinks.json to prove ownership and remove the URL bar.

Native Android WebView

Use WebView if you want to embed P.E.Y.E.K components inside a native Android UI (like a Fragments or Activities).

Configuration

Ensure DomStorageEnabled is true for local theme persistence.

WebView webView = findViewById(R.id.webview); WebSettings s = webView.getSettings(); s.setJavaScriptEnabled(true); s.setDomStorageEnabled(true); s.setDatabaseEnabled(true); webView.loadUrl("https://peyek.pcode.my.id");

Java/JavaScript Bridge

P.E.Y.E.K lets you call native Android functions directly from your web code.

1. Java Side

webView.addJavascriptInterface(new Object() { @JavascriptInterface public void notify(String msg) { toast.show(msg); } }, "AndroidBridge");

2. JavaScript Side

if (window.AndroidBridge) { window.AndroidBridge.notify("Success from PEYEK Web!"); }

Security Best Practices

  • HTTPS Only: PWA features (Service Worker, Manifest) will not work on HTTP schemes.
  • Hardware Acceleration: Must be enabled for smooth Canvas/Chart rendering.
  • Nonce Audit: If using strict CSP, ensure your WebView client handles the nonces correctly during page injection.