Friday, 8 January 2016

Important ADB/Android Commands

ADB Commands

                Shell commands for opening any URLs with any Mobile web browsers

Pre-condition
1.        Install  Chrome, Mozilla, Opera apps or any other browsers from Play store
2.       At first time launch, Do the browser setting and Open any sites at first launch

Shell Commands Step by Step

Step 1:  Make sure devices are detecting with adb devices
Step 2:  Type the below command and re place URL as below mentioned with green color
Note: If URL has any special characters such as “@$&() ..etc”, Pass URL with cotes(“ ”).


Chrome App

adb shell am start -a android.intent.action.VIEW -n com.android.chrome/.Main -d “http://igate.com

Mozilla App

adb shell am start -a android.intent.action.VIEW -n org.mozilla.firefox/.App -d “http://google.com

Opera App

adb shell am start -a android.intent.action.VIEW -n com.opera.mini.android/.Browser -d http://google.com
You can also apply the same command for other mobile browsers as well.
Only you need to get the target package name of the browser and startup activity name of the browser applciation.

For example:
adb shell am start -a android.intent.action.VIEW -n XXX.XXX.XXX /.XXX -d XXXURLXXX



Device Orientation

disable accelerometer controlling rotation - just do this once
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
rotate landscape:
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
rotate portrait:
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0
rotate upside down landscape:
adb shell content insert --uri content://settings/system  --bind name:s:user_rotation --bind value:i:3
rotate upside down portrait:
adb shell content insert --uri content://settings/system  --bind name:s:user_rotation --bind value:i:2
If you have WRITE_SETTINGS permission you can write thru the content provider in java code as well.
  
Other ADB Commands

To get all the Properties of the Device:
                adb shell getprop
To get particular property:
            adb shell getprop ro.product.model
Key events:
                adb shell input keyevent 82   (Menu Info)
                adb shell input keyevent 3  (Home)

Screen Record
adb shell screenrecord Filename.mp4


No comments:

Post a Comment