and at the same time i need to find something that collects the information of the application activity calls.

my goal is to find out upon each touch information if there is a change in activity in a particular app, detect that activity.

So, whenever a touch at (x,y) position happens getevent reports that, now if there is a button on that position it may call an activity change in the app, so i need to detect the change to new activity.

1 Answer
1

from subprocess import call
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection()
# These show the package name of the currently running package and
# the current activity's action.
device.getProperty('am.current.package')
device.getProperty('am.current.action')

With monkeyrunner you can also click/ press on buttons using (x,y) coordinates.

Another way would be to look in the logcat output for activity changes. It should look like this: Displayed com.android.gallery3d/.app.MovieActivity whyen playing a video file from gallery.

Later edit:

You can use 'am.current.package' and 'am.current.action' to see the changes in the activities. You can use:

Hi can u tell me how can i put them together in one script? what I want is upon each activity changes i keep track of all the input events and report them. I can use getevent and logcat separately, but if i can automate this whole things in one script without babysitting that will be great.
–
P basakSep 4 '12 at 1:18

Edited the answer. You can also redirect the logcat into a local file on the device and it gets updated every time you do do something that gets logged.
–
Gabriel PorumbSep 5 '12 at 15:25