I switched to Marshmallow and also updated the scan API to version 10.2.1.0. It worked fine in Lollipop but I have some troubles updating the app for Marshmallow. I'm using the following scanner model: SocketMobile CHS 8Ci. I factory reset (by scanning the barcode in the user guide) and then set it to SPP mode (by scanning another barcode in the user guide). I pair the smartphone to it from Android Settings -> Bluetooth.
Now in my App:
I think the scan API initializes OK (there used to be a test sequence in an older API but now it's gone). However I'm getting NOTIFY_SCANPI_INITIALIZED
and I don't see any errors. But something goes wrong when pairing inside my app and the scanner loses connection.
Here is logcat from pairing inside in my app:
I/System.out: 2
I/System.out: 4
I/System.out: 6
D/APP: Add a new command to send
D/APP: Add a new command to send
D/APP: There are some commands to send
D/APP: And this one has status=1 for command: 262416
I/System.out: About to do a set for ID:0x40110
D/APP: Complete event received for Context:example.app.CommandContext@efd0843
D/APP: Remove command from the list
D/APP: There are some commands to send
D/APP: And this one has status=1 for command: 1179921
I/System.out: About to do a set for ID:0x120111
D/APP: There are some commands to send
D/APP: And this one has status=2 for command: 1179921
D/APP: There are some commands to send
D/APP: And this one has status=2 for command: 1179921
E/BluetoothHelper: threadId-8329:disconnected: bt socket closed, read return: -1
W/BluetoothHelper: threadId-8329:Connection is lost
E/SktScanAPI: 1476527018622:18030272:SktScanAPI (0) !!Error!! Unable to read from Serial transport
E/SktScanAPI: 1476527018623:18030272:SktScanAPI (0) !!Error!! Error: -34 GetTransport().ReadBlock(pData,nWriteOffset,nReadSize)
E/SktScanAPI: 1476527018623:18030272:SktScanAPI (0) !!Error!! Error: -34 DoReadOperation(pbPacketReady,ppReadCompletionEvent)
E/SktScanAPI: 1476527018624:18030272:SktScanAPI (0) !!Error!! Error: -34 m_pProtocol.DoIoOperation(pbPacketReady,ppReadCompletionEvent,ppWriteCompletionEvent,ppPacketReadyToSend)
E/SktScanAPI: 1476527018624:18030272:SktScanAPI (0) !!Error!! Error: -34 pCurrentDeviceInterface.DoIoOperation(CPacketReady,pReadCompletionEvent,pWriteCompletionEvent,pPacketReadyEvent)
D/APP: Complete event received for Context:example.app.CommandContext@102c7f9
D/APP: Remove command from the list
D/APP: Add a new command to send
D/APP: There are some commands to send
D/APP: And this one has status=1 for command: -2141913085
I/System.out: About to do a set for ID:0x80550003
D/DEBUG: Paired with Socket CHS [A071E2]
V/RenderScript: 0x9fd51000 Launching thread(s), CPUs 4
W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
D/APP: Complete event received for Context:example.app.CommandContext@41e05d8
D/APP: Remove command from the list
Afterwards something weird happens. I go to Android Settings and forget the device. I click Refresh and the device no longer appears in the list. I have to factory reset it and put back to SPP mode in order to see it in the list.
I think it is no permission. It's need gps permission and open the phone's gps. Ps: you need request the permission in runtime after Android 6.0.
User contributions licensed under CC BY-SA 3.0