Search code examples
androidbluetooth-lowenergybeaconaltbeacon

How to use Bluetooth Beacon Scanning in Android Studio


I have two projects that use BLE Beacon Scanning. There is also a SDK and some documentation as well. But it's not very informative. There is also not a lot of info on BLE to begin with online. I'm not asking for a full breakdown (although that would be great). I am more so asking for places I can look up when it comes to BLE Beacons and Android Development. Thank you.


Solution

  • A few suggestions to get started:

    First, learn the fundamental concepts:

    1. To understand what BLE Beacons do, watch my video here

    2. Learn the basic concepts of "ranging" and "monitoring":

    • Monitoring means that you tell the SDK to start looking for your beacons, and let you know when you are "inside" (beacons visible) or "outside" (no beacons visible) the "beacon region".

    • Ranging means that you tell the SDK to give you regular updates -- generally once per second -- with list of all of your beacons that it detects nearby.

    1. Try playing with two Android devices each running a beacon simulator app like my BeaconScope (There is also an iOS version in case you have a second iPhone but not a second Android). Use one to transmit and one to receive. Take a look at how the beacon identifiers look for different beacon types. Each time you see a list of beacons update on the screen, that is a beacon ranging callback.

    Try using the Android Beacon Library SDK:

    • Look at the library's short code samples
    • Try cloning the Kotlin Reference App as a starting point, and make some changes to it until you understand how it works. This reference app is a simplified version of the same BeaconScope app mentioned above, which is also built with the same SDK.