esc_pos_bluetooth icon indicating copy to clipboard operation
esc_pos_bluetooth copied to clipboard

Example app is throwing getBluetoothService() called with no BluetoothManagerCallback

Open HarryAtSaltus opened this issue 2 years ago • 4 comments

I am attempting to get the example that comes with this package to run. The app starts and finds my bluetooth thermal printer. When I click the device in the list to print, a timeout error is displayed in the middle of the screen then an error occurs. Here is the error output:

D/BluetoothAdapter(19236): isLeEnabled(): ON D/BluetoothLeScanner(19236): could not find callback wrapper W/BluetoothAdapter(19236): getBluetoothService() called with no BluetoothManagerCallback W/System.err(19236): java.io.IOException: read failed, socket might closed or timeout, read ret: -1 W/System.err(19236): at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:758) W/System.err(19236): at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:772) W/System.err(19236): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:404) W/System.err(19236): at com.gprinter.io.BluetoothPort.openPort(BluetoothPort.java:58) W/System.err(19236): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.openPort(DeviceConnFactoryManager.java:156) W/System.err(19236): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin$3.run(FlutterBluetoothBasicPlugin.java:233) W/System.err(19236): at com.tablemi.flutter_bluetooth_basic.ThreadPool$1.run(ThreadPool.java:78) W/System.err(19236): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) W/System.err(19236): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) W/System.err(19236): at java.lang.Thread.run(Thread.java:923) E/libEGL (19236): call to OpenGL ES API with no current context (logged once per thread) E/ActivityThread(19236): Activity com.example.blue.MainActivity has leaked IntentReceiver com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin$5$1@c523b77 that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(19236): android.app.IntentReceiverLeaked: Activity com.example.blue.MainActivity has leaked IntentReceiver com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin$5$1@c523b77 that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(19236): at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1618) E/ActivityThread(19236): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1398) E/ActivityThread(19236): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1614) E/ActivityThread(19236): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1580) E/ActivityThread(19236): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1568) E/ActivityThread(19236): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:668) E/ActivityThread(19236): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin$5.onListen(FlutterBluetoothBasicPlugin.java:333) E/ActivityThread(19236): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:188) E/ActivityThread(19236): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:167) E/ActivityThread(19236): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84) E/ActivityThread(19236): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865) E/ActivityThread(19236): at android.os.MessageQueue.nativePollOnce(Native Method) E/ActivityThread(19236): at android.os.MessageQueue.next(MessageQueue.java:335) E/ActivityThread(19236): at android.os.Looper.loop(Looper.java:183) E/ActivityThread(19236): at android.app.ActivityThread.main(ActivityThread.java:7664) E/ActivityThread(19236): at java.lang.reflect.Method.invoke(Native Method) E/ActivityThread(19236): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/ActivityThread(19236): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) D/BluetoothSocket(19236): close() this: android.bluetooth.BluetoothSocket@145768b, channel: -1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@f340368, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@c9f5381mSocket: android.net.LocalSocket@20e0c26 impl:android.net.LocalSocketImpl@312f067 fd:java.io.FileDescriptor@af9ee14, mSocketState: INIT Lost connection to device.

Thanks in advance.

HarryAtSaltus avatar Oct 15 '21 19:10 HarryAtSaltus

I also met the same problem!!!!!!

huangjiaxiang avatar Oct 22 '21 03:10 huangjiaxiang

I have the same problem, could you solve it? Help me please

sistema5 avatar Dec 03 '21 13:12 sistema5

I have the same problem, could you solve it? Help me please

have you solved this problem

Izhar-rizvi avatar Dec 08 '21 08:12 Izhar-rizvi

Remove already existing apk from Device and run the app again it should work

usmanali353 avatar Jan 12 '22 10:01 usmanali353