Reputation: 31
I want to create an application that will enable to record screen behavior as a video that will be save programmatically on the device. Can any one help me for this ?
Upvotes: 2
Views: 1838
Reputation: 3444
For a rooted device you can take screenshots and make a video based on those screenshots using FFMPEG or JavaCV.
Actually this topic have been discussed several times.
Here's an example of How to get root access and get your screenshot.
if (Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState())) {
// we check if external storage is\ available, otherwise
// display an error message to the user using Toast Message
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File(sdCard.getAbsolutePath() + "/ScreenShots");
directory.mkdirs();
String filename = "screenshot_jpeg_" + i + ".png";
File yourFile = new File(directory, filename);
try {
Process sh = Runtime.getRuntime().exec("su", null, null);
OutputStream os = sh.getOutputStream();
os.write(("/system/bin/screencap -p " + "/sdcard/ScreenShots/" + filename).getBytes("ASCII"));
os.flush();
os.close();
sh.waitFor();
i++;
} catch (Exception e) {
e.printStackTrace();
}
}
You can check other solutions on the following topic and here for FFMPEG
Upvotes: 0
Reputation: 1006539
Fortunately, this is not possible, except perhaps on rooted devices, for obvious privacy and security reasons. An app cannot record what other apps show on the screen.
Upvotes: 2