AltBeacon Android Beacon Library

repository·master·Indexed 25 days ago

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

An Android library providing APIs to interact with beacons, enabling apps to receive notifications when beacons appear or disappear and receive ranging updates at approximately 1Hz. It includes tools for defining BeaconRegions, configuring BeaconParsers for custom beacon specifications, and generating Android ScanFilter objects to optimize Bluetooth LE scanning performance and battery life.

Tokens
485
Snippets
1
Records
5
Agent score
34%

What's inside android-beacon-library

  1. Install the Android Beacon Library via Maven

    master

    To use the Android Beacon Library in your Android project, add Maven Central to your repositories and include the library in your dependencies.

    Note: By default, the library only detects beacons meeting the AltBeacon specification. For proprietary or custom beacons, use the BeaconParser class.

    repositories {
       mavenCentral()
    }
    
    dependencies {
        implementation 'org.altbeacon:android-beacon-library:2.21.1'
    }
  2. Create scan filters for BeaconParsers

    master

    Use createScanFiltersForBeaconParsers to generate a list of Android ScanFilter objects based on a list of BeaconParser configurations. This is useful for setting up hardware-level filtering for Bluetooth LE scanning to improve battery life and performance by only receiving relevant beacon advertisements.

    You can optionally provide a list of Region objects to further refine the filters using the identifiers defined in those regions.

  3. Create scan filter data for a specific BeaconParser

    master

    Use createScanFilterDataForBeaconParser to generate internal ScanFilterData objects for a single BeaconParser. This method maps the parser's configuration (like type codes, service UUIDs, and identifiers) into raw byte arrays (filters and masks) suitable for Android's ScanFilter API.

    If the parser is configured for iBeacon (type code 0x0215), the method will incorporate the provided identifiers into the filter.