You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android平台下为Chrome桌面式网页应用设置可被调用标识的方案问询

解决Chrome桌面网页应用(PWA)的跨应用定位问题

Hi Mitchell, great question—let's walk through how to make your Chrome-created PWA discoverable by other apps, focusing first on Android (your core need) and then covering cross-platform options for Windows.

Android Platform: No Package Name? No Problem

Chrome's Android PWAs are actually wrapped as WebAPKs under the hood, with auto-generated package names (like com.android.chrome.webapk.<random-hash>) that change with updates—so relying on that is a no-go. Instead, use these reliable methods to target your PWA:

1. Custom URL Scheme (Quickest & Most Direct)

Add a protocol_handlers entry to your PWA's manifest.json to register a unique URL scheme (e.g., my-pwa://):

{
  "protocol_handlers": [
    {
      "protocol": "web+my-pwa",
      "url": "/handle-action?data=%s"
    }
  ]
}

Chrome will automatically set up an Intent filter for your WebAPK to respond to this scheme. Other Android apps can then launch your PWA with a simple Intent:

Intent launchPwaIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("my-pwa://open-dashboard"));
startActivity(launchPwaIntent);

2. Android App Links (Secure Domain-Based Association)

If your PWA is hosted on an HTTPS domain, use Android App Links to tie your domain directly to the PWA—no custom scheme needed:

  1. Update your manifest.json to define a clear start_url and scope (to control which links trigger the PWA):
{
  "start_url": "https://your-pwa-domain.com/home",
  "scope": "/",
  "display": "standalone"
}
  1. Host an assetlinks.json file at https://your-pwa-domain.com/.well-known/assetlinks.json to verify ownership of the domain (this tells Android your PWA is authorized to handle links from that domain).

Once set up, other apps can launch your PWA by opening your HTTPS URL via Intent:

Intent launchPwaIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://your-pwa-domain.com/home"));
// Optional: Specify Chrome to ensure the PWA (not another browser) handles the link
launchPwaIntent.setPackage("com.android.chrome");
startActivity(launchPwaIntent);

Cross-Platform (Android + Windows)

For Windows compatibility, stick with custom URL schemes—they work seamlessly across both platforms:

  • On Android: Use the protocol_handlers setup above.
  • On Windows: When you install the PWA via Edge (or Chrome for Windows), the browser will automatically detect the protocol_handlers config and register the scheme with the OS. Windows apps or scripts can then launch your PWA using the scheme (e.g., via command line: start my-pwa://open-settings).

Quick Tips

  • Avoid generic scheme names (like app://) to prevent conflicts with other apps.
  • To check if your PWA is installed on a device, other apps can query for apps that can handle your custom URL scheme.

内容的提问来源于stack exchange,提问作者Mitchell Day

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:23:19