Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 views
in Technique[技术] by (71.8m points)

ios7 - Combine iBeacon bluetooth low energy with Android 4.3

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.

I google a lot but this topic is quite new (I even created a new tag ) 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.

question from:https://stackoverflow.com/questions/17875430/combine-ibeacon-bluetooth-low-energy-with-android-4-3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

EDIT: The library below has been moved here:

https://github.com/AltBeacon/android-beacon-library


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:

https://github.com/RadiusNetworks/android-ibeacon-service

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.

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:

https://github.com/RadiusNetworks/android-ibeacon-service/blob/master/src/com/radiusnetworks/ibeacon/IBeacon.java#L177-L231


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...