This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aga.android.migrations.sample | |
import aga.android.migrations.AndroidDatabaseSchema | |
import aga.android.migrations.sample.cache.Database.Companion.DB_VERSION | |
import aga.android.migrations.sample.cache.Database.Companion.build | |
import android.content.Context | |
import android.database.sqlite.SQLiteDatabase | |
import androidx.test.ext.junit.runners.AndroidJUnit4 | |
import androidx.test.platform.app.InstrumentationRegistry | |
import io.requery.android.sqlite.DatabaseSource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val beaconScanner = BeaconScanner.Builder(this) | |
.setBeaconListener( | |
object : IBeaconListener { | |
override fun onBeaconEntered(beacon: Beacon) { | |
// do something with your beacon | |
} | |
override fun onBeaconExited(beacon: Beacon) { | |
// do something with your beacon | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val beaconScanner = BeaconScanner.Builder(this) | |
.setBeaconBatchListener { beacons: Collection<Beacon> -> | |
// do something with your beacons here | |
} | |
.setRangingEnabled( | |
ArmaFilter.Builder() | |
) | |
.build() | |
beaconScanner.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val ranger = beaconScanner.getRanger() | |
val distance = ranger.calculateDistance(beacon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val beaconScanner = BeaconScanner.Builder(this) | |
.setBeaconBatchListener { beacons: Collection<Beacon> -> | |
// do something with your beacons here | |
} | |
.setRangingEnabled() | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val beaconLayout = "<beacon-layout>" // search the Internet to find the layout string of your specific beacon | |
val beaconParser = BeaconParserFactory.createFromLayout(beaconLayout) | |
val beaconScanner = BeaconScanner.Builder(this) | |
.setBeaconParser(beaconParser) | |
.setBeaconBatchListener { beacons: Collection<Beacon> -> | |
// do something with your beacons here | |
} | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val region = Region.Builder() | |
.setNullField() | |
.setUuidField(UUID.fromString("01234567-0123-4567-89AB-456789ABCDEF")) | |
.setIntegerField(154) | |
.setIntegerField(10122) | |
.build() | |
val beaconScanner = BeaconScanner.Builder(this) | |
.setRegions(listOf(region)) | |
.setBeaconBatchListener { beacons: Collection<Beacon> -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onResume() { | |
super.onResume() | |
beaconScanner.start() | |
} | |
override fun onPause() { | |
beaconScanner.stop() | |
super.onPause() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val beaconScanner = BeaconScanner.Builder(this) | |
.setBeaconBatchListener { beacons: Collection<Beacon> -> | |
// do something with your beacons here | |
} | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Library | AltBeacon | iBeacon scanner android | Luch | |
---|---|---|---|---|
Different beacon layouts | ✅ | ❌ (iBeacons only) | ✅ / ❌ (some limitations when compared to AltBeacon) | |
Works in background | ✅ | ✅ | ✅ / ❌ (only via foreground services) | |
Distance calculation | ✅ | ❌ | ✅ | |
Filters by beacon data | ✅ | ✅ | ✅ | |
Detected beacons' caching | ✅ | ✅ | ❌ |
NewerOlder