andresperezmelo / print_bluetooth_thermal

Plugin para enviar bytes sin procesar a la impresora solo por ahora para Android
Other
27 stars 36 forks source link

Bluetooth devices that have been turned off can be scanned #16

Closed LeiYao123 closed 1 year ago

LeiYao123 commented 1 year ago

A Bluetooth printer was previously connected and now the power of the printer is directly turned off, but the Bluetooth device can already be scanned

Is there any way to prevent Bluetooth devices that have been turned off from being scanned

LeiYao123 commented 1 year ago

Or add a function to scan all visible Bluetooth, and the user can filter it themselves

andresperezmelo commented 1 year ago

In Android, only previously paired devices are read, in iOS if nearby Bluetooth devices are scanned, in Android nearby devices are not read because Google's policy requires that location permission be requested, which affects the use of the device. plugin for applications that do not need that permission, I invite you to read the policy, https://developer.android.com/guide/topics/connectivity/bluetooth/find-bluetooth-devices

hugeorange commented 1 year ago

@andresperezmelo I understand, My current requirement is to know if the paired devices are online. Do you have any good ideas? I need to visually display the online status of Bluetooth devices that have been paired with the current phone in a list, as shown in the following figure Because I am unable to obtain this list, I plan to use fluent_ blue, This package searches for all visible Bluetooth devices and performs a screening with paired devices. I'm not sure if this is feasible Your plugin can provide the ability to search for all Bluetooth devices, which is called startDiscovery image image

andresperezmelo commented 1 year ago

If now I understand, it would be a good feature to implement, but to read the status of Bluetooth devices on Android you need the location permission, although you could read without requesting permission, but to meet the Google policies was not added and Android only reads the devices linked in IOS if you could add, but not added because the function would not serve in Android.

The best thing for you would be to use another package to read and detect the connection status of the devices, as you are doing or plan to do is fine.

LeiYao123 commented 1 year ago

Thank you for your reply. I understand that scanning nearby online Bluetooth devices requires relevant permissions

I can now use this package(https://pub.dev/packages/flutter_scan_bluetooth) to search for nearby online Bluetooth devices, and then use PrintBluetoothThermal.pairedBluetooths to perform a layer of filtering to achieve the desired effect.

If your package comes with this feature built-in, it would be great