In my previous post about list of Google Android Secret Codes, you may find them not working in every Android devices.
So the question is how to know the secrect codes in a specific Android phone?
After searching for a while, I’ve found the could-be answer, at the following link: XDA-Developers – Android’s secret codes
1. First, root your phone
2. Secondly, create this bash shell script, name it, maybe: “secrets.sh”
#!/bin/bash echo -n > apks.txt echo -n > output.txt for x in `find . -name "*.apk"` do unzip -p $x | strings | grep -i "android.provider.Telephony.SECRET_CODE" if [ $? -eq 0 ]; then echo $x >> apks.txt fi done for x in `cat apks.txt` do mkdir "$x.folder" mv $x $x.folder done for x in `cat apks.txt` do unzip -d $x.folder $x.folder/$x done for x in `cat apks.txt` do bin2xml $x.folder/AndroidManifest.xml > $x.folder/AndroidManifest.decoded.xml done for x in `find . -name "AndroidManifest.decoded.xml"` do echo "$x:" >> output.txt cat $x | grep -i host | sed 's/android:host=\"/*#*#/' | sed 's/\" \/>/#*#*/' | sed 's/\t\t\t\t\t//' >> output.txt done
3. Download this script: http://android-random.googlecode.com/files/axml2xml.pl
and rename it to “bin2xml.pl“, then put somewhere in your Android phone $PATH.
4. Run the following commands:
chmod a+x secrets.sh ./secrets.sh cat output.txt
5. Read your output and try it out!
There are cases when you run many emulators in order to test their functions like sending messages, calling to each others …
and in Monkey scripts you need to connect to specific one.
Look at documentation on MonkeyRunner, you’ll see how to connect to a specific device:
Sample: if I want to connect to a device: “emulator-5556”, my connection part of script would be like:
device = MonkeyRunner.waitForConnection(120, "emulator-5556")
That’s all for it, now you can handle the rest of automation test for device.