There are many solutions to automatically execute shell commands during the start-up process. My favorite is using services.
So we are going to create a small script in /etc/init.d/ and use chkconfig to auto start it on boot. We call the service “starter”!
And add the following code to starter:
# chkconfig: 345 99 10
# description: starting some commands at boot
case "$1" in
echo "started" >> /home/user/service.track
And finally set permissions and configure the chkconfig:
chmod +x /etc/init.d/starter
chkconfig starter on
I had a problem with Android Monkey which the Monkey mimicked random patterns of events while this behavior prevent my system’s results to be same all the time. The fact is that by default Monkey sends pseudo-random stream of user events to the system. This behaviar may cause difficulties for developers who wants to practice a series of expected user events with the least randomization.
Well, it is possible to define the randomization seed which can almost trigger similar sequence of actions. In addition you can decide what types of event (Touche, Motion, Trackball or Navigation) are going to be send.
adb shell monkey s 10 --pct-touch 60 --pct-motion 40 -p com.android.app 200
will send 200 events to the app which contains 60% touch and 40% motion events to the system while the variables are using randomized values with the define seed of 10.
In my own case, I used an additional time interval to make it even more predictable as:
adb shell monkey -s 10 --throttle 1000 --pct-touch 100 -p com.android.app 20
which will send 20 event with intervals of 1000ms. This makes it easier to predict what is going on with the system so we can perform automated debugging in more convenient way (in this case you can expect a run time of 20 seconds in which one touch will be send every second).
Monkey Reference: http://developer.android.com/tools/help/monkey.html