dotintent / react-native-ble-plx

React Native BLE library
Apache License 2.0
2.93k stars 490 forks source link

All devices is not discoverable in Android 14🐛 #1191

Open pariharkaran opened 3 weeks ago

pariharkaran commented 3 weeks ago

Prerequisites

Expected Behavior

BLE PLX should successfully discover Bluetooth devices, including the last connected device.

Current Behavior

When i scan and try to connect with device then device is connected successfully first time. But when close and reopen app then call startDeviceScan method then last connected device is not discovering. Also when i turn off and then on bluetooth from notification panel then suddenly that bluetooth device is discovered.

Library version

3.1.2

Device

Pixel 7

Environment info

OS: macOS 14.2.1
    CPU: (8) arm64 Apple M1
    Memory: 607.06 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.0.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    Watchman: 2023.08.28.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/varshid-innvonix/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK:
      API Levels: 21, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 33, 34
      Build Tools: 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.1, 33.0.2, 34.0.0, 35.0.0
      System Images: android-30 | Google Play ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a, android-34 | Google Play ARM 64 v8a
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9619390
    Xcode: 15.0/15A240d - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.9 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^16.14.0 => 16.14.0 
    react-native: ^0.66.5 => 0.66.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Scan and Connect with device
  2. close and reopen app
  3. Scan for device

Formatted code sample or link to a repository

manager.startDeviceScan(null, null, (error, device) => { 
    if (error) { 
      // Handle error (scanning will be stopped automatically) 
      return 
    } 

    if (device.name === "MyDevice") { 
      connect() 
      manager.stopDeviceScan() 
      // Proceed with connection. 
    } 
  })

Relevant log output

All devices found except last connected one.

Additional information

No response

EmmaZachara commented 3 weeks ago

Hi @pariharkaran, Thank you for reaching out. We'll analyze the issue and get back to you as soon as we can.

ioss commented 1 week ago

What does "close and reopen" mean? Are you sure the device was disconnected, before you tried to find it again?