2

I using data collection terminal on Android. Setting data input can be in two variants(as "keyboard" or "clipboard").

I update gradle dependencies of my project (Android studio).
Before compile 'com.android.support:appcompat-v7:23.0.0'.
After compile 'com.android.support:appcompat-v7:25.0.0'.

After set "25.0.0" or "23.4.0", input from scanner as "clipboard", don't work. If setting is as "keyboard", it is ok.

I found out that device send "onKey" combination MENU + V (more precisely "KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MENU" and "KeyEvent.ACTION_UP, KeyEvent.KEYCODE_V").

I tried to reproduce on key event.

ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText("999999");

BaseInputConnection mInputConnection = new BaseInputConnection(editText, true);
mInputConnection.sendKeyEvent(new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MENU, 0));
mInputConnection.sendKeyEvent(new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_V, 0));
mInputConnection.sendKeyEvent(new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MENU, 0));
mInputConnection.sendKeyEvent(new KeyEvent(android.os.SystemClock.uptimeMillis(),android.os.SystemClock.uptimeMillis(),KeyEvent.ACTION_UP, KeyEvent.KEYCODE_V, 0));

Code above work with "23.0.0", but not with "25.0.0" or "23.4.0".

On key events with "23.0.0" : 82-DOWN, 82-UP, 50-UP

On key events with "23.4.0" and above: 82-DOWN, 82-UP, 50-DOWN, 50-UP

I wonder if this can be solved by what kind of setting or now I have to control this combination myself?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

0 Answers0