An Android Library that implements ScanSettings support for all devices.
- gradle project level
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
- gradle application level
dependencies {
implementation 'com.github.Datalux:SupportedScanSettingsLibrary:1.0'
}
val supportedScanSettings = SupportedScanSettings().getBuilder(BluetoothAdapter.getDefaultAdapter())
You can set ScanMode
, MatchMode
, NumOfMatch
or CallbackType
programmatically using getBuilder
params.
val supportedScanSettings = SupportedScanSettings().getBuilder(
BluetoothAdapter.getDefaultAdapter(),
scanMode = ScanSettings.SCAN_MODE_BALANCED,
matchMode = ScanSettings.MATCH_MODE_STICKY,
numOfMatch = ScanSettings.MATCH_NUM_FEW_ADVERTISEMENT,
callbackType = ScanSettings.CALLBACK_TYPE_FIRST_MATCH
)
See https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanSettings