在渐进式Web应用程序中接收意图

4
我正在尝试为我们的企业构建一个库存管理应用程序。由于我没有太多构建原生应用程序的经验,因此开始研究渐进式网络应用程序。我们正在使用安装了数据锁定功能的Zebra TC设备,这将允许我通过意图系统将条形码读取输出到Android应用程序中。
渐进式网络应用程序不是本地应用程序,那么是否可能将Android意图接收到渐进式网络应用程序中呢?
例如,如果我扫描条形码,我想打开网页应用程序上的一个页面来记录该物品。所以我会扫描条形码,然后它将数据发送到example.com/items/scan?barcode="扫描的条形码"。
我已经创建了一个配置文件,将条形码输出到内置的Android意图中。但是它无法打开网页应用程序到此页面,而只是打开Chrome应用程序到该页面,这并非期望的响应。
意图: android.intent.action.MAIN 意图类别: android.internet.category.LAUNCHER 然后使用格式化方式将URL附加到扫描的条形码上。
例如:https://example.com/items/scan?barcode=01234567 以上将打开一个新的Chrome页面到URL,但不是我安装的网页应用程序。任何帮助将不胜感激!
2个回答

0
根据Android文档,看起来这应该可以工作,但也许条形码应用程序的意图是错误的类别?

When a Progressive Web App is installed on Android, it will register a set of intent filters for all URLs within the scope of the app. When a user clicks on a link that is within the scope of the app, the app will be opened, rather than opening within a browser tab.

Consider the following partial manifest.json:

"start_url": "/",
"display": "standalone",

When a web app using it is launched from the app launcher, it would open https://example.com/ as a standalone app, without any browser chrome.

The [generated] WebAPK would include the following intent filters:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data
    android:scheme="https"
    android:host="example.com"
    android:pathPrefix="/" />
</intent-filter>

If the user clicks on a link within an installed app to https://example.com/read, it would be caught by the intent and opened in the Progressive Web App.

我对Android不是很了解,但你能否更换为生成android.intent.category.DEFAULT的条形码扫描器?


-1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接