How to create UUID from string in android

后端 未结 6 1245
Happy的楠姐
Happy的楠姐 2020-12-29 01:53

In my app, I scan low energy Bluetooth for specific service uuid 2415. To convert the string 2415 into uuid I am using UUID serviceUUID = UUID.fromString(

6条回答
  •  旧巷少年郎
    2020-12-29 02:19

    Hope this will help
    To Convert short hand 16-bit uuid to 128 bit uuid you can use this template "0000XXXX-0000-1000-8000-00805F9B34FB". here replace XXXX with your 16 bit uuid.

    For example:
    In your use case 128 bit UUID will be "00002415-0000-1000-8000-00805F9B34FB".
    and to get UUID from string you should use code like this

    UUID uuid = UUID.fromString("00002415-0000-1000-8000-00805F9B34FB");
    https://newcircle.com/s/post/1786/2016/01/04/bluetooth-uuids-and-interoperable-advertisements

提交回复
热议问题