This library provides support for out-of-the-box access to Beacons. Currently only the Eddystone protocol is supported
Installing
This library is available on Maven Central. You can import Kaluga Beacons as follows:
repositories {
// ...
mavenCentral()
}
// ...
dependencies {
// ...
implementation("com.splendo.kaluga:beacons:$kalugaVersion")
}
Usage
Check out the full documentation
Create a DefaultBeacons object. This gives you access to a Flow of Set<BeaconInfo>. To monitor for beacons simply call:
val beacons = DefaultBeacons(
bluetooth = // BluetoothClient
beaconLifetime = 10.seconds,
coroutineContext = // CoroutineContext
)
beacons.startMonitoring()
launch {
beacons.beacons.collect {}
}
///
beacons.stopMonitoring()