androidandroid-bluetoothandroid-ble

How to implement a custom UUID for bluetooth broadcast


I want to change my android device's Bluetooth UUID to a predefined value so that my BLE beacon can recognize it without pairing with it.

From this question I gathered that I'll have to change the service UUID but I can't find the relevant documents or tutorials.

How can I achieve this change of UUID via my app?


Solution

  • Have you looked at the Android API documentation?

    You use this https://developer.android.com/reference/android/bluetooth/le/AdvertiseData.Builder#addServiceUuid(android.os.ParcelUuid) function to set a custom service uuid to be advertised.

    A general tutorial for advertising can be found here: https://source.android.com/devices/bluetooth/ble_advertising.