question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scanning bluetooth devices give me empty list (Android 10).

See original GitHub issue

I tried this package with 2 devices,

Device 1. I’ve tried scan bluetooth device in android 10 device (Redmi Note 9 : Bluetooth version is 5.0), but callback give me nothing.

Device 2. and then I’ve tried in android 9 device (Realme C2 : Bluetooth version is 4.2), while scanning for devices managed to get a list of devices including the printer. but I can’t connect to the printer I want and terminal shows me like below :

D/BluetoothSocket(28482): close() this: android.bluetooth.BluetoothSocket@1a1c51a, channel: 2, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@80b084b, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@e3b9228mSocket: null, mSocketState: CLOSED
D/BluetoothSocket(28482): close() this: android.bluetooth.BluetoothSocket@1a1c51a, channel: 2, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@80b084b, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@e3b9228mSocket: null, mSocketState: CLOSED
W/System.err(28482): java.io.IOException: bt socket closed, read return: -1
W/System.err(28482): 	at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:558)
W/System.err(28482): 	at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:88)
W/System.err(28482): 	at java.io.InputStream.read(InputStream.java:101)
W/System.err(28482): 	at com.gprinter.io.BluetoothPort.readData(BluetoothPort.java:130)
W/System.err(28482): 	at com.example.bluetooth_print.DeviceConnFactoryManager.readDataImmediately(DeviceConnFactoryManager.java:416)
W/System.err(28482): 	at com.example.bluetooth_print.DeviceConnFactoryManager$PrinterReader.run(DeviceConnFactoryManager.java:496)
E/BluetoothPort(28482): connection device is lost
E/DeviceConnFactoryManager(28482):  read 0
D/BluetoothPrintPlugin(28482): stateStreamHandler, current action: android.bluetooth.device.action.ACL_DISCONNECTED
I/flutter (28482): cur device status: 0

*Printer XPrinter BP-428U

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
FabioPaganoAPSystemcommented, Dec 18, 2022

Yes @vborbely , in my case enabling location on the device solved the problem. Anyway I’ve seen that other packages don’t need this setting. Thank you.

1reaction
vborbelycommented, Nov 15, 2022

I had to enable Location on my phone to sense the devices. I hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bluetooth device scan always returns empty list when using ...
The flow's log shows that the scan block was indeed executed. But the list it returned is always empty. I know this cannot...
Read more >
Android 10 not working with BLE Bluetooth scanning
To make BLE scanning work on Android apps targeting Android 10 you need ... Access to device location in the background requires permission....
Read more >
No devices found during BLE scan on android 10
Hi, all my old BLE projects don't go on android 9 and up. ... StartScanning doesn't go well and rhe devices list remains...
Read more >
[Android] Empty array of services is returned #766 - GitHub
Calling .services() returns an empty array. This might be a pairing issue, since if I pair with the device via Android's bluetooth menu,...
Read more >
Clear Your Android Device's Bluetooth Cache
Clear Your Android Device's Bluetooth Cache · Open Settings, and then tap Apps. · Tap the Sort icon (the down arrow with three...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found