【问题标题】:what is the use of ActivityManager.isUserAMonkey() method? [duplicate]ActivityManager.isUserAMonkey() 方法的用途是什么? [复制]
【发布时间】:2012-04-09 19:13:17
【问题描述】:

ActivityManager.isUserAMonkey()方法有什么用?

ActivityManager.isUserAMonkey()

【问题讨论】:

标签: android


【解决方案1】:

它会告诉你用户是Test Monkey 还是monkey runner。 “Monkey 是一个命令行工具,您可以在任何模拟器实例或设备上运行它。它将用户事件的伪随机流发送到系统中,作为您正在开发的应用程序软件的压力测试。”

你可以这样使用它:

public boolean wasItTheMonkey(){

     ActivityManager activityManager =  (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);

     if(activityManager.isUserAMonkey()) {

           Log.d(TAG,"it was the monkey");
           return true;

     }

     Log.d(TAG,"it was an user");
     return false;
}

here.

【讨论】:

    【解决方案2】:

    Monkey 是一个 Android 测试套件,旨在为您的应用程序提供可重现的输入事件。我想该方法与此有关。

    【讨论】:

      【解决方案3】:

      如果用户界面当前被猴子弄乱,则此函数返回“true”。猴子是在您的模拟器或设备上运行的程序,并生成用户事件的伪随机流,例如点击、触摸,或手势,以及一些系统级事件。您可以使用 Monkey 以随机但可重复的方式对您正在开发的应用程序进行压力测试....See this link

      【讨论】:

        猜你喜欢
        • 2020-09-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-01
        • 2018-04-24
        • 2015-08-07
        • 1970-01-01
        • 2018-01-12
        相关资源
        最近更新 更多