Search code examples
androidibeaconibeacon-androidandroid-ibeacon

How to detect IBeacon in android without using any library


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.

i know some library like Radius Networks. but i don't want to use any library


Solution

  • 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.

    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.

    The source code is here: https://github.com/RadiusNetworks/android-ibeacon-service

    EDIT: the library has been moved to 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.

    If you just want to play with this, I would focus on one class from the library: IBeacon.java

    This class can convert from an Android Blueooth LE scan record to an IBeacon (if the scanned Bluetooth device is indeed an iBeacon)

    You can read about how to set up Bluetooth LE scanning on Android here: http://developer.android.com/guide/topics/connectivity/bluetooth-le.html