Android - How To Access Emulator Screenshot Via Emulator?


Answer :

It will save in your PC . You can also specify the location of screenshots from the emulator settings.

Please see the following image for reference.

enter image description here


Emulate Volume Down + Power event to trigger Android's screenshot, then screenshot pictures will be stored at emulator's /storage/emulated/0/Pictures/Screenshots.

Here is the script. Run adb shell, then copy the code below and run, you should see the emulator start taking a screenshot.

cat > /data/local/tmp/screenshot.sh <<EOF #!/bin/sh echo 'volume key: down' sendevent /dev/input/event1 1 114 1 echo 'power key: down' sendevent /dev/input/event1 1 116 1 sendevent /dev/input/event1 0 0 0 sleep 1 echo 'volume key: up' sendevent /dev/input/event1 1 114 0 echo 'power key: up' sendevent /dev/input/event1 1 116 0 sendevent /dev/input/event1 0 0 0 EOF sh /data/local/tmp/screenshot.sh 

NOTE: My emulator's input device is "/dev/input/event1", this may be different for other devices. You can get the device info by running adb shell getevent command, then press the emulator's key, the output will be something like this(My Volume Down key, these are hex numbers, so 0x0072 is 114d):

/dev/input/event1: 0001 0072 00000001 /dev/input/event1: 0000 0000 00000000 /dev/input/event1: 0001 0072 00000000 /dev/input/event1: 0000 0000 00000000 

It will save in your device (PC), you can see the location from the emulator setting, click on more icon from right side of your emulator, and then click on setting

screen shot location


Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable