react-native-ble-plx icon indicating copy to clipboard operation
react-native-ble-plx copied to clipboard

getting null device name while calling startDeviceScan

Open scrapecoder opened this issue 3 years ago • 4 comments

const scanAndConnect = () => {
bleManager.startDeviceScan(
  null,
  {allowDuplicates: false},
  (error, device) => {
    if (error) {
      if (error.message === 'BluetoothLE is powered off') {
        bleManager.enable();
      }
      // Handle error (scanning will be stopped automatically)
      return;
    }

    // Check if it is a device you are looking for based on advertisement data
    // or other criteria.

    if (device && device.name) {
      console.log('device name====>', device.name);
    }
    console.log('device-<', device);
  },
);
};

"id":"40:1E:8E:D2:E5:7E", "isConnectable":null, "localName":null, "manufacturerData":"TAAQBUccC65x", "mtu":23, "name":null, "overflowServiceUUIDs":null, "rssi":-37, "serviceData":null, "serviceUUIDs":null, "solicitedServiceUUIDs":null, "txPowerLevel":null

  • Library version: '^2.3.0'
  • Platform: Android.

scrapecoder avatar Jan 19 '22 15:01 scrapecoder

HI, can you use some external scanning application to see if the name is there or it is also null?

mciechanowicz avatar Jan 28 '22 10:01 mciechanowicz

Hi @scrapecoder , I have the same problem here in iOS . Did you find a solution for this ?

mreda7 avatar Mar 22 '22 19:03 mreda7

Same issue

Robiullah2244 avatar May 23 '22 20:05 Robiullah2244

Same issue

disconnect-ed avatar Sep 20 '22 15:09 disconnect-ed

Same issue, iOS only

rowannadon avatar Nov 14 '22 22:11 rowannadon

+1 android

renishdeveloper avatar Jan 19 '23 13:01 renishdeveloper

+1 android

yosukapro avatar Feb 15 '23 07:02 yosukapro

+1 iOS

abhinavshm95 avatar May 11 '23 12:05 abhinavshm95

+1 iOS

iSaBo96 avatar May 27 '23 08:05 iSaBo96

I have a few questions:

  • What advertising do you use (BT 5 Advertising extension or legacy)
  • What is the name (how long and does it contain special characters) of the device you are looking for?
  • What device do you use (what version of BT)

We have added a scanning option for BT 5 advertisers (disable legacy scan - https://github.com/dotintent/react-native-ble-plx/wiki/Device-Bonding) and name mapping for Android.