javaandroidtestingadbmonkey

Adb monkey testing fall out to other packages


I'm using the following command to test my android app pb = new ProcessBuilder("adb","-s", deviceId,"shell", "monkey -p" + packageName + " -v 5000");

My problem is that when the adb monkey start to test then it open also system settings, audio player etc. Is there any other solution for the adb monkey to stay only to specific package name?


Solution

    1. To prevent monkey from opening settings, there was a question and an answer: https://stackoverflow.com/a/31349378/7407999

      I have searched the answer to the problem for many days, but only this answer solves the problem.

    2. To prevent audio player, set "--pct-syskeys 0" in monkey options. See: https://developer.android.com/studio/test/monkey.html