如何在不使用任何库的情况下在android中检测IBeacon [英] How to detect IBeacon in android without using any library
问题描述
我是Ibeacon的新手,我想知道我们可以在不使用任何SDKLibrary或库的情况下在android中检测Ibeacon吗?任何人都可以提供示例示例。
i am new to Ibeacon and i want to know can we detect Ibeacon in android without using any SDKLibrary or library can any one give sample example.
我知道一些Radius网络之类的库。但我不想使用任何库
i know some library like Radius Networks. but i don't want to use any library
推荐答案
Android操作系统没有任何可检测到iBeacons的代码,但它确实具有使您可以扫描蓝牙LE设备的代码,该设备比iBeacon级别低。
The Android OS does not have any code that detects iBeacons, but it does have code that allows you to scan for Bluetooth LE devices, which are a lower-level device than an iBeacon.
您可以使用此蓝牙LE扫描功能滚动自己的代码来检测iBeacons。这正是
You can roll-your own code that detects iBeacons using this Bluetooth LE scanning. That's exactly what the Android iBeacon Library from Radius Networks does. It is open source, so if you don't want to use the library, you can simply copy blocks of code out of the library and do your own detection.
源代码在这里: https://github.com/RadiusNetworks/android-ibeacon-service
The source code is here: https://github.com/RadiusNetworks/android-ibeacon-service
编辑:该库已移至 http://github.com/AltBeacon/android-beacon-library
如果您发现用例非常简单,这可能会很好。但是,请注意不要占用太多工作,因为处理所有边缘情况可能会变得越来越复杂。
If you detection use cases are very simple, this might work fine. Be careful not to bite off too much work, though, because handling all the edge cases can become increasingly complex. That's certainly what I learned when writing the library.
如果您只是想玩这个游戏,那么我将专注于库中的一个类: IBeacon.java
If you just want to play with this, I would focus on one class from the library: IBeacon.java
此类可以将Android Blueooth LE扫描记录转换为IBeacon(如果扫描的蓝牙设备确实是iBeacon)
This class can convert from an Android Blueooth LE scan record to an IBeacon (if the scanned Bluetooth device is indeed an iBeacon)
您可以在此处阅读有关如何在Android上设置蓝牙LE扫描的信息: http://developer.android.com/guide/topics/connectivity/bluetooth-le.html
You can read about how to set up Bluetooth LE scanning on Android here: http://developer.android.com/guide/topics/connectivity/bluetooth-le.html
这篇关于如何在不使用任何库的情况下在android中检测IBeacon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!