简体   繁体   English

用于 PWA/TWA 的 CapacitorJS

[英]CapacitorJS for PWA/TWA

I'm planning to make a Webapplication for Web with should also work as PWA and TWA (on iOS and Android).我打算为 Web 制作一个 Web 应用程序,它也可以用作 PWA 和 TWA(在 iOS 和 Android 上)。

Now i'm evaluating if i can use some features like camera, geolocation, accelerometer, notifications and some more.现在我正在评估是否可以使用一些功能,如相机、地理定位、加速度计、通知等。

I tryed to make a demo project with CapacitorJS and wondering why i need to add native platforms to target and why there is a seperate folder "android".我试图用 CapacitorJS 制作一个演示项目,想知道为什么我需要添加原生平台到目标以及为什么有一个单独的文件夹“android”。

I just want to create one Website/PWA which should run as Website, on iOS and Android (in Browser) and not start a second or third seperate project for iOS and Android.我只想创建一个网站/PWA,它应该在 iOS 和 Android(在浏览器中)上作为网站运行,而不是为 iOS 和 Android 启动第二个第三个单独的项目。

How can i use CapacitorJS to target the Web and when the website is called from iOS/Android than the native functions from iOS/Android are used?我如何使用 CapacitorJS 来定位 Web 以及当从 iOS/Android 调用网站而不是使用来自 iOS/Android 的本机功能时?

You can't use the native code in a TWA or PWA, that's the whole point of the native platforms, to use native code when the web don't have a proper equivalent.你不能在 TWA 或 PWA 中使用本机代码,这是本机平台的重点,当网络没有适当的等价物时使用本机代码。

With Capacitor you use the same code for web, native iOS and native Android, is up to you if you want to use native iOS and native Android or not, but to use it you have to publish the app on the App store and Play store, the PWA will always use web APIs.使用 Capacitor,您对 Web、原生 iOS 和原生 Android 使用相同的代码,如果您想使用原生 iOS 和原生 Android 取决于您,但要使用它,您必须在 App Store 和 Play 商店上发布应用程序,PWA 将始终使用 Web API。

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

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