Skip to content

Instantly share code, notes, and snippets.

@charlesmuchene
Created April 17, 2020 03:31
Show Gist options
  • Save charlesmuchene/ffe8efa183a5b770a04785a68f85a80a to your computer and use it in GitHub Desktop.
Save charlesmuchene/ffe8efa183a5b770a04785a68f85a80a to your computer and use it in GitHub Desktop.
Android as Peripheral - Advertising
// Advertisement data: only has Trace UUID to enable filtering
val advertiseData: AdvertiseData = AdvertiseData.Builder()
.addServiceUuid(Services.TRACE.serviceUUID)
.build()
// Advertise
bleAdvertiser.startAdvertising(advertiseSettings, advertiseData, adCallback)
// Advertisement callback - delivers advertising operation status
private inner class AdCallback : AdvertiseCallback() {
override fun onStartSuccess(settingsInEffect: AdvertiseSettings?) { ... }
override fun onStartFailure(errorCode: Int) { ... }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment