Android specific device accounting

We need to find a way to capture the Android screen, without using any external software that will work on a non-root phone.

My research shows that there is no way to do this. In any case, you must have root privileges in order to be able to capture the device screen.

Further research, however, shows that for a limited number of devices, there is a way to do this without root privileges. As evidence, I can bring the following application to the Android market: UX screenshot.

He claims that the application does not require root privileges to capture the screen on the following devices:

  • Galaxy Series (S, S2, ...)
  • HTC Phones (Sensation, ...)
  • Motorola (Atrix, ...).
  • LG Optimus Series (G2X, ...)

Some say Tegra devices also support this.

Can anyone point out any documentation, at least on specific devices, so that we can at least support HTC phones, for example.

EDIT: At the moment, we are trying to use "/ system / bin / screencap", but without success on the emulator. Is it possible to take screenshots on some specific devices, just means that they allow you to use "/ system / bin / screencap" or read directly from / dev / graphics / fb 0?

Or do they provide an API for taking screenshots?

Thanks.

+1
source share
1 answer

Screen capture is an old and discussed topic on Android. In recent years, several basic options have been developed:

  • Running screencap on root devices, but you already know that.

  • Running screencap and siginging your application with a system certificate:

There is READ_FRAME_BUFFER permission, but you can only get it when your applications are signed up as a system application.

  1. Using all kinds of ADB tricks, but most of them use screencap, and AFAIK requires the device to connect to a PC.

But since the changes in Android 5 have changed.

Android 5.0 allows you to add screen capture and screen sharing capabilities of your application with the new android.media.projection APIs. This functionality is useful, for example, if you want to turn on the screen in a video conferencing application.

The new createVirtualDisplay () method allows your application to capture the contents of the main screen (default display) into a Surface object, which your application can then send over the network. Only the API allows capturing insecure screen contents, not system sound. To start screen capture, your application must first ask users for permission by launching a screen capture dialog using the intent obtained using the createScreenCaptureIntent () method.

The devices you mentioned are quite old, and I doubt that they received an official update for Android 5, this leaves you with the second option.

0
source

Source: https://habr.com/ru/post/1492020/


All Articles