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();
}