Demand:
Whether it is automated testing, or media technology , the automated operation of Android app is an operational requirement;
Automated operation can save a lot of human resources investment;
Realize:
Automation of the Android UI interface, typically there are two methods:
1. Use more is the Input command , input can directly enter "All keys, screen click, drag and direct input text content";
2. More complex operations using getevent and sendevent to complete, in theory, can operate all the input touch screen ;
Problem:
In general, input is very easy to use, you can record the coordinates, write the script is finished;
But it involves complex operation, such as long press and so on input can not be completed;
Ideas:
So still back to the GetEvent and sendevent method, Sendevent command itself is simply invoke the IOCTL to send control to/dev/input/eventx;
but because the shell script in the execution process, efficiency itself is a problem, using the shell script to play back the recorded content, there will be unexpected problems , such as:
An operation is divided into two operations to execute, which in itself is not what we expected;
Solve:
Therefore, I write in the playback script, the recording to the information, made into a C language file, directly in binary form to execute , this will not appear the operation is segmented phenomenon;
Source code: Https://github.com/scue/android_tap_record
RELATED links:
1. sendevent.c:https://github.com/android/platform_system_core/blob/master/toolbox/sendevent.c
2. Compile the tool using ndk:http://developer.android.com/tools/sdk/ndk/
〖android〗 Screen Touch-screen event recording and playback