Search code examples
androidadbmonkey

Sending commands to adb from android activity


I find we can start monkey from workstation, by using the following command:

adb shell monkey -p <package name> -v 500

But when i try to run monkey from emulator's terminal, like this:

monkey -p <package name> -v 500

it was killed by android, because of insufficient permissions.

I need kick off monkey from the device, (without any connections to PC), my question is, how can i send commands from an android activity to adbd, so I can run monkey from device directly.


Solution

  • The monkey is implemented in Java, you could integrate it in your app. Or, if you have a rooted device, use su -c monkey to run as root. The shell user actually has more permissions than regular app users, that is why you are getting insufficient permissions.