Closed TailNest closed 5 years ago
Devices do not have to advertise name as per Core Bluetooth Specification
For identifying a device use it's id
. Keep in mind that the id
is different on iOS and on Android — see https://github.com/Polidea/react-native-ble-plx/wiki/Device-Connecting
@dariuszseweryn Sorry but that's a bit confusing, could you confirm my understanding is correct?
You have to use the id to identify the device but it's different on iOS and android, so we should then store two ids and compare them based on the OS?
You can compare ids between Android devices if peripheral uses a static MAC address*. iOS ids are not comparable between devices i.e. the same peripheral will have different ids on two iOS devices.
* core bluetooth specification can teach you more about MAC addresses in Bluetooth.
i.e. the same peripheral will have different ids on two iOS devices
If this is true I'm really screwed because my entire product requires this. How can I identify a beacon if the ID is different on every device? Are you sure about this?
If this is true, do I have to use the device name instead?
Name is usually quite wobbly. It could be major, minor, region, uuid or other unique things that beacons usually advertise. Go figure what is the best idea for your case
Why is name wobbly? I get localName on iOS and Android. It blows my mind that there's no unique identifier that's consistent 😄
So, I guess I'll have to learn about major and minor then? Is there a guide on how to identify the beacons consistently? All I need is a unique identifier and the rssi, nothing more.
It is not easy to filter by name simply because it is a string and it is hard to make it readable and unique. Unique ID is bad because of privacy and ability to locate the user. Good luck on learning how to solve your use case
Thanks. And if you ever find out how beacons work do share! I really want to solve this. If this doesn't work I see no use for beacons other than spam devices.
I don't understand how this library reports device name
and localName
as null
. I simply logged all detected devices, and every single one, null
. Using my smartphone to see all bluetooth devices in the area reveals them with human readable names. Therefore, they are reporting them. I instantiated a manager and scanned for devices. Is there a step i missed?
@sudomann Did you find your way around this? I have the same exact issue. It also happens that when there's no available bluetooth device, my bluetooth scan still prints a device id.
@tyrone2kx oddly enough, it started displaying showing the names soon after. I also noticed sometimes the scan results had duplicates. One might show the name, while the other might not.
It might help to log all the scan results and closely inspect.
does anyone figuredout how to handle the problem. because i could nt find the problem in the whole internet.. all the names and localnames of the devices are returning null. Please can one tell me how to display the names of the devices
Does anyone found a solution for this? All the names and localnames are null for all devices.
@SatyaGanesh399 have you found solution for this?
@aliwaqar981 nope. i'm not woring on react native anymore
Ah, have you moved to flutter? A general feedback 😄
Expected Behavior
Scanning devices should return a name in order to understand which device is which.
Current Behavior
Scanning devices return objects with
name
andlocalName
equalsnull
:Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions. Both JS and platform logs can be enabled via setLogLevel function call.
Library version: 1.0.3
Platform: currently tested only in Android
Contents of the
package.json
file:Formatted code sample or link to a repository: