I hereby claim:
- I am mohsenoid on github.
- I am mohsenoid (https://keybase.io/mohsenoid) on keybase.
- I have a public key ASCmbE-Oa-53fhh-NupPHcgx4L8kF5uq83h7yqc7Hi9-4Ao
To claim this, I am signing this object:
val scanFilters = listOf( | |
ScanFilter.Builder() | |
.setManufacturerData(manufacturerId, manufacturerData, manufacturerDataMask) | |
.build() | |
) | |
bluetoothScanner.startScan( | |
scanFilters, | |
settings, | |
scanCallback |
val scanResponse = AdvertiseData.Builder() | |
.addServiceUuid(userUuid.toParcelUuid()) | |
.build() | |
bluetoothAdvertiser.startAdvertising( | |
advertiseSettings, | |
advertiseData, | |
scanResponse, | |
advertiseCallback | |
) |
if (!closeToMe.hasBleFeature()) { | |
Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_LONG).show() | |
finish() | |
} |
closeToMe.start(object : CloseToMeCallback { | |
override fun onSuccess() { | |
log("Beacon started successfully!") | |
} | |
override fun onError(throwable: Throwable) { | |
log(throwable.message) | |
} | |
}) |
closeToMe.results.observe(this, Observer { results -> | |
log("Result: results) | |
}) |
closeToMe.isBluetoothEnabled.observe(this, Observer { isActive-> | |
log("Bluetooth isActive: $isActive") | |
if (isActive == false) { | |
// start again | |
} else { | |
// do something | |
} | |
}) |
closeToMe.state.observe(this, Observer { state -> | |
log("Beacon state: $state") | |
when (state) { | |
CloseToMeState.STARTED -> { | |
// do something | |
} | |
else -> { | |
// do other thing | |
} |
<uses-permission android:name="android.permission.BLUETOOTH" /> | |
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | |
<!-- Privacy changes in Android 10 requires ACCESS_FINE_LOCATION | |
https://developer.android.com/about/versions/10/privacy/changes --> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
closeToMe = CloseToMe.Builder(context, manufacturerUuid) | |
.setUserUuid(userUuid) | |
.setMajor(1U) | |
.setMinor(1U) | |
.setVisibilityDistanceMeter(3.0) | |
.setVisibilityTimeoutMs(5_000) | |
.build() |
I hereby claim:
To claim this, I am signing this object: