I'm not that clued up on how Android handles bluetooth connections I'm afraid.
But... You get the device name from Advertising packets usually. However, the connecting device doesn't have to advertise at all in order to connect to your Android phone.
For instance if you connect to the Bangle.js from your PC, at no point is the bluetooth name of the PC ever transferred to the Bangle. I imagine the same is true for Android.
My guess is BluetoothDevice is used for all kinds of stuff. In the case where you got a BluetoothDevice via Adertising, getName would be populated
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm not that clued up on how Android handles bluetooth connections I'm afraid.
But... You get the device name from Advertising packets usually. However, the connecting device doesn't have to advertise at all in order to connect to your Android phone.
For instance if you connect to the Bangle.js from your PC, at no point is the bluetooth name of the PC ever transferred to the Bangle. I imagine the same is true for Android.
My guess is BluetoothDevice is used for all kinds of stuff. In the case where you got a BluetoothDevice via Adertising, getName would be populated