〖android〗 Screen Touch-screen event recording and playback

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.