My phone runs rooted 2.3.6 Gingerbread. I write these lines to take a screenshot:
adb shell screencap -p /sdcard/screen.png
It says permission denied! So I add su
, like this:
adb shell "su -c 'screencap -p /sdcard/screen.png'"
Now when I run it, it says "screenshot: not found!"
You could accomplish this with MonkeyRunner instead of ADB by creating a screenshot.py file with the following content:
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection()
result = device.takeSnapshot()
result.writeToFile('<some path>/screenshot.png','png')
and run it with the command (on Windows)
<android sdk path>\tools\monkeyrunner.bat <some path>\screenshot.py