结合iBeacon蓝牙低耗能与Android 4.3 [英] Combine iBeacon bluetooth low energy with Android 4.3

查看:338
本文介绍了结合iBeacon蓝牙低耗能与Android 4.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一种方式来从Android设备检测iBeacon(IOS 7.0的功能)。我读了Android文档,它似乎是iBeacon是某种形式,它发送其位置GATT服务器。虽然Android的文件说,我不应该查询该数据,但对于检测这将是所必要的。

I'm looking for a way to detect iBeacon (iOS 7.0 feature) from an Android device. I read the Android documentation, where it seem that the iBeacon is some kind of GATT server which sends its position. While the Android documentation says that I should not poll that data, but for the detection this would be nessesary.

我google了很多,但这个话题是相当新的(我甚至创造了一个新的标签的 ibeacon ),所以我会很高兴,如果我得到一些链接,从iOS世界当中descripes实施ressources。此外,如果有一些Android的库,我没有发现尚未将是很好的。

I google a lot but this topic is quite new (I even created a new tag ibeacon) so I would be happy if I get some links to ressources from the iOS world which descripes the implementation. Also if there are some Android libs which I did not find yet would be nice.

推荐答案

编辑:下面的库现在已经撤下,但替代库,现在可以在这里找到:

<一个href="https://github.com/AltBeacon/android-beacon-library">https://github.com/AltBeacon/android-beacon-library

我已经移植了iOS7 iBeacon的SDK到Android,并能看到标准iBeacons并估算其范围。在code可以在这里找到:

I have ported the iOS7 iBeacon SDKs to Android, and was able to see standard iBeacons and estimate their range. The code is available here:

<一个href="https://github.com/RadiusNetworks/android-ibeacon-service">https://github.com/RadiusNetworks/android-ibeacon-service

对于这个工作,你需要的Andr​​oid 4.3而推出的低能耗蓝牙的API。您还需要一个设备与低能量蓝牙芯片组。

For this to work, you need Android 4.3 which introduced the Low Energy Bluetooth APIs. You also need a device with a low energy bluetooth chipset.

如果你不想使用上面的满库,你可以滚你自己。 iBeacons只需发送一个BLE广告每秒一次开始的字节的已知序列。您只需告诉机器人做了BLE的扫描,得到每个广告,寻找一个与已知iBeacon字节序列开始。然后,您可以解析出iBeacon领域。这里是c中的显示了$ C $如何做到这一点:

If you don't want to use the full library above, you can roll your own. iBeacons simply transmit a BLE advertisement once per second that start with a known sequence of bytes. You simply have to tell Android to do a BLE scan, get each advertisement, and look for one that starts with the known iBeacon byte sequence. You can then parse out the iBeacon fields. Here is the code the shows how this is done:

<一个href="https://github.com/RadiusNetworks/android-ibeacon-service/blob/master/src/com/radiusnetworks/ibeacon/IBeacon.java#L177-L231">https://github.com/RadiusNetworks/android-ibeacon-service/blob/master/src/com/radiusnetworks/ibeacon/IBeacon.java#L177-L231

这篇关于结合iBeacon蓝牙低耗能与Android 4.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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