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

Not support android 12 #10

Closed acimkompor closed 1 year ago

acimkompor commented 1 year ago

I tried under android 12, it's very good, but when I try on android 12, the bluetooth list doesn't appear. I have tested it on several Android 12 devices.

final List<BluetoothInfo> listResult = await PrintBluetoothThermal.pairedBluetooths;
await Future.forEach(listResult, (BluetoothInfo bluetooth) {
  String name = bluetooth.name;
  String mac = bluetooth.macAdress;
});

Thank you.

andresperezmelo commented 1 year ago

Note that from Android 12 onwards to have access to a list of paired devices and connect to Bluetooth devices you must have the Nearby Devices permission, the permission is requested by the package, in the app permissions it must be to enable.

The package has an option that allows you to see if the permission is enabled. PrintBluetoothThermal.isPermissionBluetoothGranted

acimkompor commented 1 year ago

Note that from Android 12 onwards to have access to a list of paired devices and connect to Bluetooth devices you must have the Nearby Devices permission, the permission is requested by the package, in the app permissions it must be to enable.

The package has an option that allows you to see if the permission is enabled. PrintBluetoothThermal.isPermissionBluetoothGranted

Thank you in advance,

Previously I added permissions when the application was running, and on some devices it worked fine, after I tried it on the Xiaomi 12 Lite device, it didn't work well, I couldn't connect to the printer. get the following error

D/====> print: (29359): connect: UID 10295 / PID 29359 lacks permission android.permission.BLUETOOTH code 256562799
D/====> print: (29359): finalizo tk: connection state:false

thanks for solving this problem.

andresperezmelo commented 1 year ago

And does the phone have the nearby devices permission enabled?

acimkompor commented 1 year ago

And does the phone have the nearby devices permission enabled?

yes, it's allowed and it works on some devices, but it doesn't work on my xiaomi android 12 device.

andresperezmelo commented 1 year ago

In some cases when I was testing, even though I enabled the permission, it was not recognized. I don't remember if it was that I uninstalled the application and reinstalled it. In flutter, I used flutter clean and then flutter pub get