Posts Tagged ‘script’

Retrieve all secrect codes from your Android devices

December 21, 2011 Leave a comment

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: “

echo -n > apks.txt
echo -n > output.txt
for x in `find . -name "*.apk"`
unzip -p $x | strings | grep -i "android.provider.Telephony.SECRET_CODE"
if [ $? -eq 0 ]; then
echo $x >> apks.txt
for x in `cat apks.txt`
mkdir "$x.folder"
mv $x $x.folder
for x in `cat apks.txt`
unzip -d $x.folder $x.folder/$x
for x in `cat apks.txt`
bin2xml $x.folder/AndroidManifest.xml > $x.folder/AndroidManifest.decoded.xml
for x in `find . -name "AndroidManifest.decoded.xml"`
echo "$x:" >> output.txt
cat $x | grep -i host | sed 's/android:host=\"/*#*#/' | sed 's/\" \/>/#*#*/' | sed 's/\t\t\t\t\t//' >> output.txt

3. Download this script:

and rename it to ““, then put somewhere in your Android phone $PATH.

4. Run the following commands:

chmod a+x
cat output.txt

5. Read your output and try it out!


Have fun!

Pete Houston

Categories: Tricks & Tips Tags: , , , ,

Connect to a specific device in Monkey script

July 7, 2011 1 comment

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.

Pete Houston