简体   繁体   English

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

[英]PWA(Progressive Web App) - Launch PWA from Windows UWP application

I am working on a POC where I need to launch a PWA from Windows application instead of opening the url in the browser. 我在POC上工作,我需要从Windows应用程序启动PWA,而不是在浏览器中打开URL。

What I tried:- 我试过的

  1. Created a PWA and installed it on Windows. 创建了PWA并将其安装在Windows上。

  2. Created a UWP application with Xamarin.Forms. 使用Xamarin.Forms创建了UWP应用程序。

  3. Called URL from my UWP application using Device.OpenUri(new Uri("http://localhost:8887")); 使用Device.OpenUri(new Uri("http://localhost:8887"));从我的UWP应用程序中调用的URL Device.OpenUri(new Uri("http://localhost:8887"));

It is opening a browser instead of my PWA. 它正在打开浏览器而不是我的PWA。 Below is the manifest.json 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"
}

Can someone please guide me for achieving this use case. 有人可以指导我实现此用例吗?

You could follow this document to wrap your PWA as UWP app. 您可以按照本文档将PWA包装为UWP应用。 Then, you could declare a protocol in the Package.appxmanifest file like the following: 然后,您可以在Package.appxmanifest文件中声明一个协议,如下所示:

在此处输入图片说明

After that, you could install it on windows and launch the url myapp:/// from your another UWP app. 之后,您可以将其安装在Windows上,并从另一个UWP应用启动URL myapp:///

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM