bluetooth_print
bluetooth_print copied to clipboard
android.bluetooth.device.action.ACL_DISCONNECTED
When ACL_CONNECTED, DeviceConnFactoryManager wait read. But then BluetoothSocket close and connection device is lost
I have the same problem. Did you find the solution?
Could you solve it? Help me
If I try to connect to a printer of bluetooth type DEVICE_TYPE_DUAL (3) , it will connect and maintain a connection.
However, if I try to connect to a printer of bluetooth type DEVICE_TYPE_LE (2), it will connect but, after a short while, disconnect resulting in the ACL_CONNECTED
mentioned above.
I think the reason for this is that while it is connected, the device prompts the user to pair with the printer, times out, then disconnects.
Why is it asking to pair?
If I use https://pub.dev/packages/flutter_blue, I can open and maintain a connection to both the type 2 and 3 printers above with no request to pair.
On iOS, it works fine.
I've managed to trace it to the following line in the plugin...
https://github.com/thon-ju/bluetooth_print/blob/26bcfbdf2f46fb8fcf8ea9044a6b84b69d260cb4/android/src/main/java/com/example/bluetooth_print/DeviceConnFactoryManager.java#L156
During this call, it connects; prompts to pair; throws and exception; disconnects.
The call to com.gprinter.io.PortManager.openPort
in the gprintersdkv2.jar then delegates the call to the android.bluetooth
library.
Unfortunately, I cannot find the source code for gprintersdkv2.jar
anywhere and ever the Maven links end up in a 404. The intention here was to use the latest library, if there is one, or modify the source... but no can do.
Can anyone find the source to the gprintersdkv2.jar
? As an aside, iOS using libGSDK.a
- is it the same thing? I don't know.
See #96 as a workaround