We need to find a way to capture Android screen, without using any external software, which will work on a non-rooted phone.
My research shows that there is no way to do that. In any way, you should have root permissions, to be able to capture device's screen.
Further research, however, shows, that there is a way for limited number of devices, to do that, without having root privileges. As a proof I can bring following application on Android market: Screenshot UX.
It claims, that app doesn't need root permissions for capturing screen on following devices:
- Gallaxy series (S,S2,...)
- HTC phones (Sensation, ...)
- Motorola (Atrix, ...).
- LG Optimus series (G2X, ...)
Some say, that Tegra devices support that also.
Could anyone point on some documentation, at least on specific devices, so we can at least support HTC phones, for example.
EDIT: For now we are trying to use "/system/bin/screencap", with no success on emulator though.
Does availability of taking screenshots on some certain devices just means that they allow to use "/system/bin/screencap" or read directly from /dev/graphics/fb0?
Or they give some API for taking screenshots?
Thanks.
Screen capturing is an old and much discussed topic on android.
Over the last years few major options developed:
Running screencap on rooted devices, But you already know this.
Running screencap and siginging your application with system certificate:
There is a permission READ_FRAME_BUFFER but you only can obtain it when your apps are signed as system application.
- Using all sort of ADB tricks, but most of them use screencap and AFAIK require you to have the device connected to a PC.
But Since Android 5 things have changed.
Android 5.0 lets you add screen capturing and screen sharing
capabilities to your app with the new android.media.projection APIs.
This functionality is useful, for example, if you want to enable
screen sharing in a video conferencing app.
The new createVirtualDisplay() method allows your app to capture the
contents of the main screen (the default display) into a Surface
object, which your app can then send across the network. The API only
allows capturing non-secure screen content, and not system audio. To
begin screen capturing, your app must first request the user’s
permission by launching a screen capture dialog using an Intent
obtained through the createScreenCaptureIntent() method.
The devices you mentioned are quite old and I doubt that they got an official update to android 5, this leaves you with the 2nd option.