BluetoothDevice always returns null on getName()

浪子不回头ぞ 提交于 2019-12-02 03:49:54

It could be that your BLE device isn't broadcasting a name. The broadcast payload is limited to 31 bytes and some manufacturers omit a name to save room.

I'm not using getName() anymore since it seems undefined when it returns a real name (and if so how old is this cached name?) and when it is null. Just parse the scanRecord in the advertisement data and get the name from there OR read the name characteristic in the GATT DB if you are connected.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!