what is the use of ActivityManager.isUserAMonkey() method?
ActivityManager.isUserAMonkey()
what is the use of ActivityManager.isUserAMonkey() method?
ActivityManager.isUserAMonkey()
It will tell you if the user is the Test Monkey or the monkey runner. "The Monkey is a command-line tool that that you can run on any emulator instance or on a device. It sends a pseudo-random stream of user events into the system, which acts as a stress test on the application software you are developing."
You can use it like that:
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;
}
See here.
This function returns "true" if the user interface is currently being messed with by a monkey..and The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.... See this link