New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device Name is always Null #456
Comments
Hi @momone50, I'm the friendly issue checker. If you think it's fine to make an exception, just ignore this message. Thanks! |
So, you're sure it's not connected to something else and that's why it's not showing up? |
I don't have any problem to find the device. Only to retrieve its name. |
There is the potential when scanning for devices that your device will pick up devices that don't have a Name. So it's best to filter these out in your list. I recommend making the following change to better filter out unwanted devices.
|
Hi, |
Another follow up question. The device you're trying to use, you're able to see the name using another application such as |
I’m having the same issue. Device.name is always null on android. Run the same Xamarin build on iOS and most names are filled in. My device’s name has never failed on iOS build, and never worked on Android. |
I definitely see devices that have a name via BLE.Client.Droid (on current master branch with Android 11). Not all devices may have their name set up, though (my scans also show several devices without a name). Simply seeing a device without a name is not necessarily a bug, I assume. If you see the name of a particular device on iOS, but not on Android, that may indicate a problem on the Android side. I'll note that Android 5 is rather old. Possibly this might be a problem with older Android versions? @MynaBay, which Android version are you using? |
I also see devices with a name on Android 8 (but that's the oldest Android version that I have access to right now). |
I read this from stackoverflow: I have an off-market Chinese tablet that has BLE support, however, it always return a BLE equipped device with its name as "null" when I call startLeScan. The issue was resolved by calling startDiscovery. Remember that if your app targets 23 or above, you will need to have location permissions for startDiscovery to work correctly. Hope it helps. Could be there are some chinese tablets that are not returning name in statLeScan, and is required to user startDiscovery |
Tested, if you put BluetoothAdapter.DefaultAdapter.StartDiscovery(); in your Mainactivity names are working |
Hi, I need to read Device Name from available devices, in order to filter results.
(My device has a specific device name, always beginning the same way).
Unfortunatly, device.Name is always empty. I think i should be able to read it before even connecting to it. Otherwise i couldn't
filter correctly
Steps to reproduce
await adapter.StartScanningForDevicesAsync();
2.Add devices in a List in Discover Event Handler
private void Device_Discovered_Event(object sender, Plugin.BLE.Abstractions.EventArgs.DeviceEventArgs e) { IDevice device = e.Device; devices.Add(device); }
3.Try to read Device Name:
foreach (IDevice device in devices) { Debug.WriteLine(device.Name); }
Expected behavior
device.Name should contain a Name but it is always equal to "".
When scanning my device with a Ble Scan application, it manages to get the Name. With Plugin.BLE, it always fail.
Version of the Plugin: 2.1.1
Platform: Android 5.0
Device: Samsung Grand Prime
The text was updated successfully, but these errors were encountered: