简体   繁体   English

如何将 TWA 的 javascript 代码绑定到本机函数?

[英]How to bind javascript code of TWA to native functions?

I am currently trying to enrich my PWA (Progressive Web App).我目前正在尝试丰富我的 PWA(渐进式 Web 应用程序)。 My PWA is an app which works with jQuery / HTML5 and it works.我的 PWA 是一个与 jQuery/HTML5 一起工作的应用程序,它可以工作。 Now I want to build a trusted web activity (TWA) as I want to go directly to the newest technology (not the WebView from Android Studio, as TWA uses Chrome as Engine and I really like Chrome).现在我想构建一个受信任的网络活动 (TWA),因为我想直接使用最新技术(不是来自 Android Studio 的 WebView,因为 TWA 使用 Chrome 作为引擎,我真的很喜欢 Chrome)。 Also, I have a request which I can not make via PWA, only via native functions (phone tracking).另外,我有一个无法通过 PWA 发出的请求,只能通过本机功能(电话跟踪)发出。

Now my plan is, that my TWA can communicate with the native app.现在我的计划是,我的 TWA 可以与本机应用程序进行通信。 Is there a way so that I can call in the TWA a JS function and this JS function is linked to a native function?有没有办法让我可以在 TWA 中调用一个 JS 函数并且这个 JS 函数链接到一个本机函数?

使用受信任的 Web 活动时,无法从 JavaScript 调用本机函数。

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

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