简体   繁体   中英

How to get proper(decode) manufacturer advertisement data from ble devices?

i am new to android so,basically i am developing an app which get's the data from ble devices to do further operations over it. What i have done until now :-

i scanned the devices got their rssi and macaddress,but when i tried to get the scanRecord in the callback method,to access the manufacturer data i got sparseArray like this:-

{89=[-128,42, 75, -112, 75, -34, 0, 0, 0, 0, 0, -81, 22]}

but what i want it like this,

[59,00,80,BC,26,01,00,FF,FF,00,00,04,00,00,00]

Actually Is solved it by following steps:-

I get the manufacturer data by passing the manufacturer id

getScanRecord().getManufacturerSpecificData(manufacturerId)

Which returns the byte array which afterwards i convert it to the hex string by writing my own function and that's it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM