androidbluetooth-lowenergydevice-name

Android Bluetooth LE scanned devices missing Name


I've been using StartLeScan for quite a while, the names of the returned devices after a scan are never populated. I could never figure out why, I just get the mac address back. Today I ran a scan from the OS BT settings page and it showed only the MAC addresses until the scan completed, then it showed the names. Now when I run a scan programmatically the names are always populated.

Why does StartLeScan not return the device names?


Solution

  • Name is not broadcast with the MAC during scan, the name you see later is a local cache after you have required it from the device.

    My memory might be betraying me, but I believe settings makes a separate request for the name after they scan. Settings also has a local separate cache for keeping track of devices and their current state.

    Remember that the name is not really a good way of identifying a device as it may be changed by the user.