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