I'm currently developing an application using Flutter, where I need to capture barcodes using different Android scanner devices. I've encountered a peculiar issue with a Zebra (MC330M) scanner running on Android 8.1.
Issue Description:
When I first launch my application on the Zebra scanner, I get a series of KeyRepeatEvents
with unknown logical keys and null character values. However, after closing and reopening the application, it starts working as expected, and I receive the correct key events.
Devices Used:
- Cipherlab scanner running Android 9 (Works as expected)
- Zebra scanner running Android 8.1 (Problematic)
Logs:
Here are some logs from Flutter, showing the inconsistent behavior:
Before closing and reopening the app:
(KeyEvent logs indicating KeyRepeatEvents with unknown logical keys and null character values)
After closing and reopening the app:
(KeyEvent logs showing correct key events)
[Logs are similar to the ones mentioned in the Stack Overflow question.]
Troubleshooting:
I have checked the DataWedge settings for the Zebra (MC330M) scanner, and they seem to be in line with the application's requirements.
Code:
The entire codebase for this implementation can be found here.
1 Replies
these key presses are just from the hardware button on the scanner to trigger the scan action
I/flutter ( 7704): KeyEvent: KeyDownEvent#9d9b8(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104150)
I/flutter ( 7704): KeyEvent: KeyRepeatEvent#42666(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104651)
I/flutter ( 7704): KeyEvent: KeyRepeatEvent#0c5de(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104702)
I/flutter ( 7704): KeyEvent: KeyRepeatEvent#a8c5a(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104753)
I/flutter ( 7704): KeyEvent: KeyRepeatEvent#a89ea(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104803)
I/flutter ( 7704): KeyEvent: KeyRepeatEvent#ffe04(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104853)
I/flutter ( 7704): KeyEvent: KeyRepeatEvent#5314e(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104905)
I/flutter ( 7704): KeyEvent: KeyRepeatEvent#608ed(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104956)
I/flutter ( 7704): KeyEvent: KeyUpEvent#b4a6c(physicalKey: PhysicalKeyboardKey#0b109(usbHidUsage: "0x11000002e8", debugName: "Key with ID 0x11000002e8"), logicalKey: LogicalKeyboardKey#38915(keyId: "0x1100002734", keyLabel: "", debugName: "Key with ID 0x01100002734"), character: null, timeStamp: 0:00:02.104970)