Home » Android » android – Strange function in ActivityManager: isUserAMonkey. What does this mean, what is its use?

android – Strange function in ActivityManager: isUserAMonkey. What does this mean, what is its use?

Posted by: admin March 11, 2020 Leave a comment

Questions:

I found the following function in package android.app.ActivityManager.

public static boolean isUserAMonkey ()

The reference describes:

public static boolean isUserAMonkey () Since: API Level 8

Returns “true” if the user interface is currently being messed with by a monkey.

I was shocked by this strange function. And have a few questions.

  • What does this (user interface is currently being messed with by a
    monkey) mean?

  • What is the practical use of this function?

  • Why do they use isUserAMonkey for the function name?

How to&Answers:

This method is for checking whether the current user is a test user by some automatic testing, called ‘monkey’ by Android devs.

Answer:

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.

just refer these links also: