PWA(Progressive Web App) - 从Windows UWP应用程序启动PWA

问题描述 投票:0回答:1

我正在进行POC,我需要从Windows应用程序启动PWA,而不是在浏览器中打开URL。

我尝试了什么: -

  1. 创建了一个PWA并将其安装在Windows上。
  2. 使用Xamarin.Forms创建了一个UWP应用程序。
  3. 使用Device.OpenUri(new Uri("http://localhost:8887"));从我的UWP应用程序调用的URL

它打开浏览器而不是我的PWA。以下是manifest.json PWA: -

{
  "name": "Test",
  "short_name": "Test",
  "icons": [{
    "src": "images/icons/icon-128x128.png",
      "sizes": "128x128",
      "type": "image/png"
    }, {
      "src": "images/icons/icon-144x144.png",
      "sizes": "144x144",
      "type": "image/png"
    }, {
      "src": "images/icons/icon-152x152.png",
      "sizes": "152x152",
      "type": "image/png"
    }, {
      "src": "images/icons/icon-192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    }, {
      "src": "images/icons/icon-256x256.png",
      "sizes": "256x256",
      "type": "image/png"
    }],
  "start_url": "/index.html",
  "display": "standalone",
  "background_color": "#3E4EB8",
  "theme_color": "#2F3BA2"
}

有人可以指导我实现这个用例。

xamarin.forms uwp progressive-web-apps xamarin.uwp
1个回答
1
投票

您可以按照此document将您的PWA包装为UWP应用程序。然后,您可以在Package.appxmanifest文件中声明一个协议,如下所示:

enter image description here

之后,您可以在Windows上安装它并从您的另一个UWP应用程序启动URL myapp:///

© www.soinside.com 2019 - 2024. All rights reserved.