蓝牙LE应用程序,如何建立它的交叉plaftorm(iOS-Android)? [英] Bluetooth LE app, how to build it cross-plaftorm (iOS-Android)?

查看:307
本文介绍了蓝牙LE应用程序,如何建立它的交叉plaftorm(iOS-Android)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个与蓝牙LE设备通信的应用。我想要一些方法避免开发它两次,iOS和Android。是否有一个跨平台的应用程序框架,它对蓝牙LE有很好的支持?

I am working on an app that talks to a Bluetooth LE device. I would like some way to avoid developing it twice, for iOS and for Android. Is there a cross-platform app framework that has good support for Bluetooth LE?

我已经快速浏览了Cordova(PhoneGap),Appcelerator,Xamarin等框架通常的嫌疑人:例如此列表),但我不能如果他们(a)在每个平台上支持蓝牙LE,和(b)如果他们做,是否通过本机调用(访问如何?)或某种包装器的本地API(包装器看起来像什么?),和(c)如果它是一个包装器,它是多么完整,它是多么稳定。

I have had a quick look at frameworks like Cordova (PhoneGap), Appcelerator, Xamarin etc (the usual suspects: for example this list) but I can't figure out if they (a) support Bluetooth LE on each platform at all, and (b) if they do, whether it is via native calls (accessed how?) or some kind of wrapper to the native API (what does the wrapper look like?), and (c) if it is a wrapper, how complete it is, and how stable it is.

如果您有这方面的经验,您可以在不同的框架中总结蓝牙LE支持的状态吗?

If you have experience with these, could you summarize the status of Bluetooth LE support in different frameworks?

编辑:了解各种选项和下面的答案:

EDIT A bit of info from digging into various options and from the answers below:

  • Cordova: several open-source plugins, for example https://github.com/evothings/cordova-ble https://github.com/don/cordova-plugin-ble-central https://github.com/randdusing/BluetoothLE (not a complete list). Evothings is a nice Cordova + bluetooth setup. Do these work in other Cordova-based app frameworks like Appery.io, Telerik AppBuilder, Ionic Creator?

Xamarin:这只是通过 MonoTouch.CoreBluetooth Android.Bluetooth 。这意味着使用它们的代码实际上不是跨平台的,但是它们可能与本机API一样工作(因为它们本质上是本机API)。

Xamarin: this just uses the native APIs via MonoTouch.CoreBluetooth and Android.Bluetooth. This means the code using them is not actually cross-platform, but they are likely to work the same as the native API (because they essentially are the native API).

Appcelerator有用于蓝牙的第三方商业插件( https://marketplace.appcelerator.com/apps/3834 )和
https://marketplace.appcelerator.com/apps/6611 ),没有内置支持。这些工作?

Appcelerator has third-party commercial plugins for Bluetooth (https://marketplace.appcelerator.com/apps/3834 and https://marketplace.appcelerator.com/apps/6611), no built-in support. Do these work?

除了蓝牙,我的需求是非常少:这个应用程序将有很多的UI元素,但不是一个复杂的种类,只是一堆按钮/复选框/滑块在一堆不同的屏幕(这将是非常繁琐的维护两个平台)。我还需要对REST API进行几次调用。速度不是超重要,没有那么多的应用程序逻辑(它主要是用C写的),和原生UI看起来不是那么重要。

P.S. Besides Bluetooth my needs are pretty minimal: this app will have a lot of UI elements but not of a complicated kind, just a bunch of buttons/checkboxes/sliders on a bunch of different screens (which would be very tedious to maintain on two platforms). I'd also need to make a few calls to a REST API. Speed is not super important, there isn't that much app logic (it is mostly written in C now), and native UI look is not that important. However working on older versions of the platforms is important, ideally back to Android 4.3 and iOS 7.0.

推荐答案

重要的是, p>我一直在为BluetoothLE使用 Randdusing 的Cordova插件,它适用于Android和iOS(Windows手机仍在开发中) 。作为Cordova,它旨在使用HTML5 / JavaScript应用程序,但插件本身(所有Cordova插件?)都是用本机代码编写的。
在我的项目的早期,我尝试 Evothings ,它也有BLE插件,但我发现一些问题,我不知道这些是否已经解决了。
我的应用程序在UI需求方面听起来非常相似,如果你喜欢,我可以帮助整合BLE代码 - 但是你需要先将你的'c'重写为javascript。
BTW您要求使用旧版Android,但AFAIK BLE仅支持 Android 4.3或更高

I have been using Randdusing's Cordova plugin for BluetoothLE and it works well for Android and iOS (Windows phone still under development). Being Cordova it's designed to work with an HTML5/JavaScript app, but the plugins themselves (as all Cordova plugins?) are written in native code . Earlier in my project I tried Evothings which also has BLE plugin but I found some problems, and I don't know if these have been resolved yet. My app sounds pretty similar to yours in terms of the UI requirements, and I can possibly help with integrating the BLE code if you like - but you'll need to rewrite your 'c' into javascript first. BTW you ask for using with older Android but AFAIK BLE is only supported in Android 4.3 or higher.

这篇关于蓝牙LE应用程序,如何建立它的交叉plaftorm(iOS-Android)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆