This question already has an answer here:
- Is there a way to get current activity's layout and views via adb? 5 answers
I am currently using bash and adb to automate configurations on Android devices. When I run my code on one device, the 'adb shell input tap xxx xxx' commands are 100% accurate and do their job well.
When I run the script on multiple devices, the coordinates seem to change - the device starts clicking at seemingly random spots on the screen, as if they have reassigned themselves new locations.
Logically, what could be happening right here? Relevant parts of the script are below.
DeviceConfig () {
#Location
./adb -s "$usb" shell am start -n com.android.settings/.Settings
./adb -s "$usb" shell input tap 215 695
./adb -s "$usb" shell input tap 1210 55
#Icons
./adb -s "$usb" shell am start -n com.estrongs.android.pop/.view.FileExplorerActivity
sleep 7
./adb -s "$usb" shell input tap 165 500
./adb -s "$usb" shell input tap 165 500
./adb -s "$usb" shell input tap 165 500
./adb -s "$usb" shell input tap 165 500
sleep 1
./adb -s "$usb" shell input tap 155 150
sleep 1
./adb -s "$usb" shell input tap 155 374
sleep 1
./adb -s "$usb" shell input swipe 680 130 680 130 1500
sleep 1
./adb -s "$usb" shell input tap 920 130
sleep 1
./adb -s "$usb" shell input tap 1185 723
sleep 1
}
for usb in $(./adb devices -l | awk '/ device usb:/{print $3}'); do DeviceConfig $usb ; done