0

I want to take automated screenshots of a android device every 10 seconds and then save them into a directory. I used this method but it doesn't work who can help me please!!!

Process sh = Runtime.getRuntime().exec("su");
OutputStream  os = sh.getOutputStream();
os.write(("/system/bin/screencap -p /mnt/sdcard/img.png").getBytes("ASCII"));
os.flush();
os.close();
try {
    sh.waitFor();
} catch (InterruptedException e) {
    e.printStackTrace();
}
Michael Yaworski
  • 13,410
  • 19
  • 69
  • 97
yasso
  • 303
  • 1
  • 5
  • 11

1 Answers1

1

Here is the library I didn't check It but title seems helpful https://code.google.com/p/android-screenshot-library and want to thanks @still_learning

This is how we can take screenshot using adb tool http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html

adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell rm /sdcard/screen.png

Extra efforts: You need to do some programming.

For Windows: Make a .bat file or .cmd file that will execute at every 10 second and contains above code. for execution in every 10 second set the system scheduler.

For Linux : Make .sh file or .py file that contains above code (systax might be change in linux) and you need to find "how to schedule program execution in linux?".