Thursday 14 October 2021

adb commands

=========================================================

To use ADB commands, we have to install adb-setup-1.4.3.exe (your flexible version)
==> Download the above software. Double click on it.

 ==> Click on next and Finish it. after that from the command prompt, you can use adb commands.

=========================================================

To get the list of connected devices with serial numbers and details:

adb devices -l 

List of devices attached

12xxxxxxxx345       device product:xxx model:xxxxx device:yyy transport_id:1

12xxxxxx5Ex50         device product: xxxx model:xxxx device:yyy transport_id:2

=========================================================


Copy Files from Computer to Phone

If you want to copy files from your computer to your phone using adb

adb -s serial_number push <source> <destination>

Ex1: adb -s 24x30x02x3 push  C:\Narendra\poject_location\configutration.js  /sdcard/configutration.js

Ex2: adb -s 24x30x02x3 push  C:\Narendra\result.xml  /sdcard/downoads/result.xml

Note: Donot forget to replace [source] and [destination] with actual file paths.

=========================================================

you can copy files from your phone to your computer using adb

adb -s serial_number pull <source> <destination>

Ex: adb -s 24x30x02x3 pull   /sdcard/downoads/result.xml  C:\Narendra\result.xml 

=========================================================

install apk in connected mobile devices:

adb -s <device serial_number> install "path/to/file.apk" 
Note: Before installing the latest apk, uninstall old apk
=========================================================
uninstall apk on connected mobile devices:

adb -s <device serial_number> uninstall xxxxxxx.apk 

=========================================================

To decrease/increase the resolution of the connected device

adb -s <device serial_number> shell wm density 130

=========================================================

To get the mobile wifi  configuration values
adb -s <device serial_number> shell dumpsys wifi
=========================================================
How to Check the device either in the fastboot mode?
fastboot devices -l
=========================================================
If a device is in fastboot mode.! How to change the device to adb mode.
adb -s <serial_number>  fastboot reboot
=========================================================

To get device build version and all firmware related info:

step1 : adb devices -l  

step2 : adb -s <serial_number> shell

step3 : getprop | grep -i build

=========================================================

To get product name

adb -s <device serial_number> shell getprop ro.product.name

product_name will be displayed

======================================================== =

To get the build date  
command: adb -s serial_number shell uname -a
Responce : Linux localhost #1 SMP XXXXXXX Mon Dec 6 01:32:26 IST 2021 armv7l

=========================================================

Android Firmware Flashing process:

step 1: Download firmware, place somewhere & then through command prompt move to that location  step 2: adb devices -l  

            Expected result: connected device's serial_ numbers should display

optional part: check for existing firmware info of the device.

                        adb -s <serial_number> shell <enter> 

                        getprop | grep -i build

step 3: adb -s serial_number reboot bootloader

step 4: fastboot devices -l 

            Expected result: that specific device serial only should display under fastboot devices list

step 5:  check the serial number properly by using the command: fastboot oem SYS_SN

step 6: Run the .bat file directly  (>xxxxxxxxxs.bat enter) wait till you have observed pass or success on the command prompt  

step 7: wait for some time reason: the device will restart after firmware flashed

step 8: optional part: check for existing firmware info of the device.

                        adb -s <serial_number> shell <enter> 

                        getprop | grep -i build

step 9: After the flashing process is completed make sure that you have installed the required apk s on your device, before executing test cases.

=========================================================

fastboot reboot

=========================================================




=========================================================

installation of certificates:

C:\...\....\...\\Common\Android>adb -s  <device serial_number> push eap.cer /sdcard/

eap.cer: 1 file pushed, 0 skipped. 1.6 MB/s (1186 bytes in 0.001s)


C:\...\....\...\Common\Android>adb -s <device serial_number>  push eap.p12 /sdcard/

eap.p12: 1 file pushed, 0 skipped. 4.2 MB/s (4004 bytes in 0.001s)

===================================================================

W.A.P  If os_type is android "Launches wifi Settings page"

def launch_wifi_settings_page (os_type,deviceID):

'''Launches wifi Settings page

INPUT: ``os_type``  :- DUT OS

``deviceID``  :- Device ID in case of Android

        OUTPUT: Launches wifi Settings page

'''

if(os_type == "Android"):

run_adb_command("adb -s "+deviceID +" shell am start -a android.settings.WIFI_SETTINGS")

return 1

else:

raise AssertionError("$os_type not supported")

===================================================================


                                Request: Please provide your valuable comments


No comments:

Post a Comment