Reputation: 423
Using adb shell input text <String>
or adb shell input keyevent <KEYCODE_NAME>
works perfectly fine in sending text to the android device, but my issue is speed.
Using something like input keyevent KEYCODE_A KEYCODE_A KEYCODE_SPACE KEYCODE_A KEYCODE_ENTER;
will type the text quickly, but separating it into 2 commands will result in a (1 sec) delay between the 2 commands (Much Slower).
Sample Shell Code:
Method 1 (Much faster):
input keyevent KEYCODE_A KEYCODE_A KEYCODE_ENTER KEYCODE_A KEYCODE_A KEYCODE_ENTER;
Method 2:
input keyevent KEYCODE_A KEYCODE_A KEYCODE_ENTER;
input keyevent KEYCODE_A KEYCODE_A KEYCODE_ENTER;
I would like to type a large text as fast as possible, but having a shell script with input keyevent
followed by a large combination of KEYCODE_A for instance, will not be executed. (Large Shell Commands are aborted)
What would be the best way to send large text without having long delays?
Would sendevent
be faster in sending large text?
Note:
input text <String>
is that it also has a limit to it's size and it can't perform special keyevents inside of it (Like the Back Button or Enter/New Line ).Thanks in Advance.
Upvotes: 2
Views: 2509
Reputation: 16058
I realise you are after Android Shell, but I think you have exhausted the options available to you there.
I know of one way that is faster than what you have tried, using Instrumentation
:
final Instrumentation mInst = new Instrumentation();
mInst.sendKeySync(new KeyEvent(KeyEvent.ACTION_DOWN, keycode));
mInst.sendKeySync(new KeyEvent(KeyEvent.ACTION_UP, keycode));
Upvotes: 3