我怎样才能链接android的活性变化与​​亚洲开发银行getevent命令? [英] How I can link android activity change with adb getevent command?

查看:140
本文介绍了我怎样才能链接android的活性变化与​​亚洲开发银行getevent命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目,我需要做以下的事情,

for my project i need to do the following thing,

  1. 在得到亚行getevent命令设备触摸事件。
  2. ,并在同一时间,我需要找到的东西,收集的应用程序活动通话信息。

我的目标是找出在每次触摸信息如果在活动的变化在一个特定的应用程序,检测活动。

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

所以,当触摸的(X,Y)的位置发生getevent报告说,现在如果在该位置时,它可以调用应用程序中的活动变化的按钮,所以我需要检测的变化,以新的活动。

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.

这可怎么办呢?任何想法?

How this can be done? any idea?

推荐答案

您可以在Python脚本试试这个:

You can try this in a python script:

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')

使用monkeyrunner您也可以点击/使用上的按钮preSS(X,Y)坐标。

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

另一种方法是看在logcat的输出活动的变化。它应该是这样的:显示com.android.gallery3d / .app.MovieActivity whyen从图库播放视频文件

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.

后来编辑:

您可以使用am.current.package'和'am.current.action看变化活动。你可以使用:

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

call('adb getevent', shell = True)  

要赶点击/触摸事件。所有在同一个脚本。

to catch the click/ touch events. All in the same script.

这篇关于我怎样才能链接android的活性变化与​​亚洲开发银行getevent命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆