PDA

View Full Version : what is ALLOWED_PACKAGE in monkey command?



lqxkj520@gmail.com
12-15-2010, 09:15 AM
i don't understand the ALLOWED_PACKAGE meaning,

where can i get the referrence usage below? some examples?


sherry@sherry-R18:~$ adb -e shell
# monkey
usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
[-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
[--ignore-crashes] [--ignore-timeouts]
[--ignore-security-exceptions]
[--monitor-native-crashes] [--ignore-native-crashes]
[--kill-process-after-error] [--hprof]
[--pct-touch PERCENT] [--pct-motion PERCENT]
[--pct-trackball PERCENT] [--pct-syskeys PERCENT]
[--pct-nav PERCENT] [--pct-majornav PERCENT]
[--pct-appswitch PERCENT] [--pct-flip PERCENT]
[--pct-anyevent PERCENT]
[--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
[--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
[--wait-dbg] [--dbg-no-events]
[--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
[--port port]
[-s SEED] [-v [-v] ...]
[--throttle MILLISEC] [--randomize-throttle]
COUNT

extorian
12-15-2010, 09:47 AM
To quote Google's own instructions for Monkey: http://developer.android.com/guide/developing/tools/monkey.html



If you specify one or more packages this way, the Monkey will only allow the system to visit activities within those packages. If your application requires access to activities in other packages (e.g. to select a contact) you'll need to specify those packages as well. If you don't specify any packages, the Monkey will allow the system to launch activities in all packages. To specify multiple packages, use the -p option multiple times — one -p option per package.


Monkey basically simulates random button and screen presses to test how your app responds to various inputs. You don't want it going off and sending input to the phone unconstrained as it will end up calling your friends, sending text messages with random text, deleting files, changing settings, etc. So, you can restrict it to sending input to your application (i.e. its package) and any other applications you need it to send input to in the process of testing your app. For example, if you need to choose a Contact, your app may call the Contacts app, or if you need to open a webpage, your app will use the Browser app, if you need to view a location on a map it will call Google Maps, etc. This is where the ALLOWED_PACKAGEs come in. You will need to list any packages (i.e. apps) on the command line if your app needs to use them.

At a minimum, you want to use -p your.app.package.name to test your own app.

lqxkj520@gmail.com
12-16-2010, 04:28 AM
thank you very much, Wonsanim, so how can i list any packages in command line?

extorian
12-16-2010, 04:41 AM
Didn't know Wonsanim had replied to this thread. :p

I don't know how to do that, but you don't need to. You know the package name of your app because you wrote it. It would be listed one the first line of the code in all classes in your app.

If you call any other apps in your app, then you will have called that by package name, so you would know those too.

lqxkj520@gmail.com
12-17-2010, 12:26 AM
i found a very interest thing that all packages located in the data/data/ path. so i list them,

adb -e shell
#cd data/data
#ls

all the packages include system's and my own here!.

now i am interested about your voicemail notification, very glad to know you , i am a student from China.Would you mind make friend with me?

extorian
12-17-2010, 04:26 AM
That's a great tip - thanks for sharing.

I don't use the Friend system on here, because it allows people to private message me. I get so many PMs every day that I don't have the time to reply to them all, and that makes me feel like I'm letting people down, so if you have questions or stuff to talk about, it's best just posting it on the forum as that allows other people to answer too, and there are people out there that know a lot more than me :)