简体   繁体   English

使用PhoneGap / Cordova时的数据管理/计算

[英]Data management / calculations when using PhoneGap / Cordova

I am developing an application on iOS and Android . 我正在开发iOSAndroid上的应用程序。 The application uses Bluetooth (standard Bluetooth not BLE) to send/receive information. 该应用程序使用蓝牙(标准蓝牙而不是BLE)来发送/接收信息。 It may not be of relevance but for reference my current test device is a Nexus 5. 它可能没有关系,但作为参考,我目前的测试设备是Nexus 5。

The application is built with Cordova (or PhoneGap ) so the UI is HTML5/JavaScript/css and the Bluetooth plugin is written in native (Java for Android, Obj-C for iOS). 该应用程序使用Cordova (或PhoneGap )构建,因此UI是HTML5 / JavaScript / css,蓝牙插件是用本机编写的(适用于Android的Java,适用于iOS的Obj-C)。 Futhermore the UI was created with the help of Bootstrap , jQuery , Backbone.js and Underscore.js . 此外,UI是在BootstrapjQueryBackbone.jsUnderscore.js的帮助下创建的。

My question is regarding the management of the Bluetooth data coming in. I haven't developed it yet, but I wish to have a Bluetooth listener service running, that will be able to perform calculations on the Bluetooth data being received. 我的问题是关于蓝牙数据的管理。我还没有开发它,但我希望运行蓝牙监听服务,这将能够对正在接收的蓝牙数据进行计算。 Before start, I kind of wanted to get an idea of my options and an idea of what the best method of attack would be. 在开始之前,我有点想知道我的选择,并想知道最好的攻击方法是什么。 I could write a plugin to manage the data received, so that the data would be dealt with by native code (which to my knowledge would run smoother). 我可以编写一个插件来管理收到的数据,这样数据就可以通过本机代码处理(根据我的知识,这些代码会运行得更顺畅)。

However, since my application is multi-platform (currently only iOS and Android but possibly more platform in the future) it makes more sense to me trying to tackle the data calculations without using plugins/native. 但是,由于我的应用程序是多平台的(目前只有iOS和Android,但未来可能还有更多平台),因此我尝试在不使用插件/本机的情况下解决数据计算更有意义。 Would it be feasible to attempt this in JavaScript? 在JavaScript中尝试这个是否可行? I've heard it can be quite laggy and cause timing issues within Cordova/PhoneGap applications when you increase the complexity. 我听说当你增加复杂性时,它可能会非常滞后并导致Cordova / PhoneGap应用程序中的计时问题。

Does anyone have any experience with this and may be able to shed some light? 有没有人有这方面的经验,也许能够解决一些问题? It would be most appreciated. 非常感谢。

Thanks. 谢谢。

I wrote a plugin that interfaces with a BT printer and found that the best performance was achieved with handling all calls and logic in a background thread. 我写了一个与BT打印机接口的插件,发现通过处理后台线程中的所有调用和逻辑实现了最佳性能。 If not, the UI performance suffered greatly. 如果没有,UI性能受到很大影响。

It is was not desirable to have to write everything twice in each native language, but the performance gain was well worth the effort. 不希望每种母语都写两次,但性能提升非常值得。

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

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