如何为蓝牙广播实现自定义 UUID

时间:2021-05-06 10:19:33

标签: android android-bluetooth android-ble

我想将我的 android 设备的蓝牙 UUID 更改为预定义的值,以便我的 BLE 信标无需配对即可识别它。

this 问题我收集到我必须更改服务 UUID,但我找不到相关文档或教程。

如何通过我的应用实现 UUID 的这种更改?

1 个答案:

答案 0 :(得分:0)

您是否看过 Android API 文档?

您使用此 https://developer.android.com/reference/android/bluetooth/le/AdvertiseData.Builder#addServiceUuid(android.os.ParcelUuid) 函数来设置要公布的自定义服务 uuid。

可在此处找到有关广告的一般教程:https://source.android.com/devices/bluetooth/ble_advertising