带有HTML5的跨平台移动应用程序

时间:2022-06-16 03:04:37

I was asked to provide a tablet application with HTML5/JS/CSS which does not have dependency on any platform. Requirements:

我被要求提供一个HTML5 / JS / CSS的平板电脑应用程序,它不依赖于任何平台。要求:

  • Cross-platform mobile/tablet application
  • 跨平台移动/平板电脑应用程序

  • Offline capability and Storage (it should work in lack of internet connectivity and be able to synch after get connected)
  • 离线功能和存储(它应该在缺乏互联网连接的情况下工作,并且在连接后能够同步)

  • Real-time data (it should be able to show any small changes from sensor values)
  • 实时数据(它应该能够显示传感器值的任何微小变化)

  • I should be able to connect to a CAN interface and get sensor values and ECU data. Because I have not come up with any solution for this part, I am thinking about Bluetooth. However, HTML5 doesn't support Bluetooth.
  • 我应该能够连接到CAN接口并获取传感器值和ECU数据。因为我没有为这部分提出任何解决方案,我正在考虑蓝牙。但是,HTML5不支持蓝牙。

I'd appreciate to give me some vision if HTML5/JS/CSS can deal with this requirements (especially with Bluetooth)

如果HTML5 / JS / CSS可以满足这一要求(特别是蓝牙),我很感激给我一些愿景

Another question is that is it possible not to use any frameworks such as PhoneGap, RHoMobile, .... and just develop cross-platform app with raw HTML5/CSS/JS and have all requirements?

另一个问题是,是否可以不使用任何框架,如PhoneGap,RHoMobile,....并且只使用原始HTML5 / CSS / JS开发跨平台应用程序并具备所有要求?

4 个解决方案

#1


3  

Have you looked in to PhoneGap / Cordova yet?

你有没有看过PhoneGap / Cordova?

You can easily create cross-platform mobile applications using HTML5, JS and CSS.

您可以使用HTML5,JS和CSS轻松创建跨平台的移动应用程序。

http://phonegap.com

The built-in API provides access to most of the device's native features and functions. You can manage offline storage using localStorage or SQLite databases, and can detect network connectivity statuses to determine if you are offline / online and what level of connection you have (Edge, 3G, 4G, WiFi). With a combination of those, you could manage your data synchronisation.

内置API提供对大多数设备本机功能的访问。您可以使用localStorage或SQLite数据库管理脱机存储,并可以检测网络连接状态以确定您是否处于脱机/联机状态以及您具有的连接级别(Edge,3G,4G,WiFi)。通过这些组合,您可以管理数据同步。

As for bluetooth, the PhoneGap API doesn't support it out of the box, but it is highly extensible so developers can create their own plugins for missing or required functionality.

至于蓝牙,PhoneGap API不支持开箱即用,但它具有高度可扩展性,因此开发人员可以为缺失或所需功能创建自己的插件。

The community is awesome and many of the plugins have been compiled into a central repository on GitHub: https://github.com/phonegap/phonegap-plugins

该社区非常棒,许多插件已编译到GitHub上的*存储库:https://github.com/phonegap/phonegap-plugins

I know that there is a Bluetooth plugin for Android available on that repository.

我知道该存储库上有一个适用于Android的蓝牙插件。

You can also write your own plugins quite easily to add any extra features that you need:

您也可以非常轻松地编写自己的插件,以添加所需的任何额外功能:

http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-android.html

http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-ios.html

** EDIT **

**编辑**

You posted an amendment to the question afterI'd written this answer mentioning PhoneGap. The honest answer is no, without a framework that interacts with the native device functionality, raw HTML5, CSS and JS would not be able to deal with bluetooth etc.

在我写了这个提及PhoneGap的答案之后,你发布了一个问题的修正案。诚实的答案是否定的,如果没有与本机设备功能交互的框架,原始HTML5,CSS和JS将无法处理蓝牙等。

#2


1  

No, you cannot. A pure web application is not able, and will likely never be able, to use bluetooth.

你不能。纯粹的Web应用程序无法使用蓝牙,也可能永远无法使用蓝牙。

HTML5 Bluetooth and Audio

HTML5蓝牙和音频

Having developed a Web App before, I can tell you that anything involving offline has to be simple, and using device hardware is out.

在开发Web应用程序之前,我可以告诉您,涉及离线的任何事情都必须简单,并且使用设备硬件已经完成。

Check out the frameworks, you may be able to get something to work. But it may just be a better/more realistic bet to develop a Native Application from the get go.

查看框架,您可以获得一些工作。但是从开始开发本机应用程序可能只是一个更好/更现实的选择。

#3


1  

After a lot of searching I came up with MoSync which is a cross-platform SDK and is intended for developing different mobile applications. I believe MoSync can be the best answer for this question since it is really a rich SDK (C, C++, HTML, JavaScript) and has great tools and community that try their best to help you.

经过大量搜索后,我想出了MoSync,这是一个跨平台的SDK,用于开发不同的移动应用程序。我相信MoSync可以成为这个问题的最佳答案,因为它真的是一个丰富的SDK(C,C ++,HTML,JavaScript),并且有很好的工具和社区可以尽力帮助你。

For further information I encourage developers to check here or visit their websites.

有关详细信息,我鼓励开发人员查看此处或访问他们的网站。

#4


0  

Most of the future mobile apps will be developed using HTML5. HTML5 standards are getting adopted very rapidly and those standards are supporting phone features like GPS, Accelerometer, Camera, Storage etc.

大多数未来的移动应用程序将使用HTML5开发。 HTML5标准被迅速采用,这些标准支持GPS,加速度计,相机,存储等手机功能。

I will recommend you to use PhoneGap if you want to use any device features.

如果您想使用任何设备功能,我建议您使用PhoneGap。

#1


3  

Have you looked in to PhoneGap / Cordova yet?

你有没有看过PhoneGap / Cordova?

You can easily create cross-platform mobile applications using HTML5, JS and CSS.

您可以使用HTML5,JS和CSS轻松创建跨平台的移动应用程序。

http://phonegap.com

The built-in API provides access to most of the device's native features and functions. You can manage offline storage using localStorage or SQLite databases, and can detect network connectivity statuses to determine if you are offline / online and what level of connection you have (Edge, 3G, 4G, WiFi). With a combination of those, you could manage your data synchronisation.

内置API提供对大多数设备本机功能的访问。您可以使用localStorage或SQLite数据库管理脱机存储,并可以检测网络连接状态以确定您是否处于脱机/联机状态以及您具有的连接级别(Edge,3G,4G,WiFi)。通过这些组合,您可以管理数据同步。

As for bluetooth, the PhoneGap API doesn't support it out of the box, but it is highly extensible so developers can create their own plugins for missing or required functionality.

至于蓝牙,PhoneGap API不支持开箱即用,但它具有高度可扩展性,因此开发人员可以为缺失或所需功能创建自己的插件。

The community is awesome and many of the plugins have been compiled into a central repository on GitHub: https://github.com/phonegap/phonegap-plugins

该社区非常棒,许多插件已编译到GitHub上的*存储库:https://github.com/phonegap/phonegap-plugins

I know that there is a Bluetooth plugin for Android available on that repository.

我知道该存储库上有一个适用于Android的蓝牙插件。

You can also write your own plugins quite easily to add any extra features that you need:

您也可以非常轻松地编写自己的插件,以添加所需的任何额外功能:

http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-android.html

http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-ios.html

** EDIT **

**编辑**

You posted an amendment to the question afterI'd written this answer mentioning PhoneGap. The honest answer is no, without a framework that interacts with the native device functionality, raw HTML5, CSS and JS would not be able to deal with bluetooth etc.

在我写了这个提及PhoneGap的答案之后,你发布了一个问题的修正案。诚实的答案是否定的,如果没有与本机设备功能交互的框架,原始HTML5,CSS和JS将无法处理蓝牙等。

#2


1  

No, you cannot. A pure web application is not able, and will likely never be able, to use bluetooth.

你不能。纯粹的Web应用程序无法使用蓝牙,也可能永远无法使用蓝牙。

HTML5 Bluetooth and Audio

HTML5蓝牙和音频

Having developed a Web App before, I can tell you that anything involving offline has to be simple, and using device hardware is out.

在开发Web应用程序之前,我可以告诉您,涉及离线的任何事情都必须简单,并且使用设备硬件已经完成。

Check out the frameworks, you may be able to get something to work. But it may just be a better/more realistic bet to develop a Native Application from the get go.

查看框架,您可以获得一些工作。但是从开始开发本机应用程序可能只是一个更好/更现实的选择。

#3


1  

After a lot of searching I came up with MoSync which is a cross-platform SDK and is intended for developing different mobile applications. I believe MoSync can be the best answer for this question since it is really a rich SDK (C, C++, HTML, JavaScript) and has great tools and community that try their best to help you.

经过大量搜索后,我想出了MoSync,这是一个跨平台的SDK,用于开发不同的移动应用程序。我相信MoSync可以成为这个问题的最佳答案,因为它真的是一个丰富的SDK(C,C ++,HTML,JavaScript),并且有很好的工具和社区可以尽力帮助你。

For further information I encourage developers to check here or visit their websites.

有关详细信息,我鼓励开发人员查看此处或访问他们的网站。

#4


0  

Most of the future mobile apps will be developed using HTML5. HTML5 standards are getting adopted very rapidly and those standards are supporting phone features like GPS, Accelerometer, Camera, Storage etc.

大多数未来的移动应用程序将使用HTML5开发。 HTML5标准被迅速采用,这些标准支持GPS,加速度计,相机,存储等手机功能。

I will recommend you to use PhoneGap if you want to use any device features.

如果您想使用任何设备功能,我建议您使用PhoneGap。