Marshmallow に切り替え、スキャン API をバージョン 10.2.1.0 に更新しました。Lollipop では問題なく動作しましたが、Marshmallow のアプリを更新する際に問題が発生しました。次のスキャナー モデルを使用しています: SocketMobile CHS 8Ci。工場出荷時設定にリセットし (ユーザー ガイドのバーコードをスキャンして)、SPP モードに設定しました (ユーザー ガイドの別のバーコードをスキャンして)。Android の設定 -> Bluetooth からスマートフォンをペアリングします。
今私のアプリで: スキャン API は正常に初期化されると思います (以前は古い API にテスト シーケンスがありましたが、現在はなくなっています)。しかし、私は取得NOTIFY_SCANPI_INITIALIZED
していますが、エラーは表示されません。しかし、アプリ内でペアリングすると問題が発生し、スキャナーの接続が失われます。
これが私のアプリ内のペアリングからのlogcatです:
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
その後、奇妙なことが起こります。Android の設定に移動して、デバイスを忘れてしまいました。[更新] をクリックすると、デバイスがリストに表示されなくなります。リストに表示するには、出荷時設定にリセットして SPP モードに戻す必要があります。