简体   繁体   中英

Cannot detect iBeacon using AltBeacon/android-beacon-library

Currently, I am working on a project using an android phone to detect iBeacons and read/write the uuid, major minor etc information from iBeacon

After searching on the web, it seems that AltBeacon/android-beacon-library is recommended to use for detecting the iBeacons. However, I cant find any result of iBeacons when I try the sample code of the the following link- http://altbeacon.github.io/android-beacon-library/samples.html or I run the sample reference app- https://github.com/AltBeacon/android-beacon-library-reference . I have download an app called " Locate " from Google Play developed by Radius Networks and it aslo cannot find my iBeacon.

All above ways fail to show the iBeacons result. When I try debug on it, functions like didRangeBeaconsInRegion(), didEnterRegion(), didExitRegion() never be called.

However from logcat I find some device information:

10-24 13:56:31.878: D/BluetoothAdapter(14042): onScanResult() - Device=20:CD:39:80:60:F7 RSSI=-70

I have tested that my iBeacons should be ok with the app - iBeacon Detector and it can detect my iBeacon.

Did I miss some steps? Or this library is not suitable for my development? Please comment.

I am quite new to Android development and iBeacons, please let me know if you need additional requirement. Thanks for you help.

I'm trying to do the same thing as you did. And I also want to use AltBeacon/android-beacon-library, but I haven't done it yet, answer below is my guess, hope it can give you some clue.

I think your problem might be the misuse of the library.

According to the home page of Android-beacon-library http://altbeacon.github.io/android-beacon-library/index.html , it says,

By default, it will only detect beacons meeting the open AltBeacon standard. If you wish to configure the library to work with different types of beacons, see the documentation for the BeaconParser class.

iBeacon is a beacon standard different from the open AltBeacon standard used in the Android-beacon-library, so if you want your app using the Android-beacon-library to detect an iBeacon device, you have to implement the BeaconParser which can parser messages conforming to iBeacon standard.

You basically need to do this:

beaconManager.getBeaconParsers().add(new BeaconParser().
       setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24"));

For more information, refer to Is this the correct layout to detect iBeacons with AltBeacon's Android Beacon Library?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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