Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android screenshot - How to?

Is there any neat way of accessing screenshot of android device programatically. I am looking for some 15-20fps.

I found one code android\generic\frameworks\base\services\surfaceflinger\tests\screencap\scr eencap.cpp, i built the executable and put it in /data and changed the mode 777

but when i tried to execute it using adb shell it gives the below error.

# chmod 777 test-screencap 
chmod 777 test-screencap 
# ./test-screencap test 
./test-screencap test 
screen capture failed: Function not implemented 

I also know that we can access fb0 but its not a right method as suggested by android team. Is it possible to access the screen shot at the frameworks layer. I beleive surface flinger composes individual layers and gives it to framebuffer.Where exactly this is done ? Can a application be able to access such codes.

There are some java apps also which use ddms to actually capture this framebuffer data without root access. But the fps is really poor.

I beleive there should be some or the other way of doing the above job. Please suggest me some neat way of doing it. Suggestions are welcome.

like image 983
junky Avatar asked Feb 18 '26 22:02

junky


1 Answers

What you are trying to do is not possible if you don't have a rooted phone, there is an app out there that does what you are trying, Screenshot ER. The latest OEM's are putting it into their /system/apps now... so you may be able to use their apps, check out this article for devices that have enabled this feature. Other than that your really stuck but there are implications with screen captures enabled as this could lead apps saving screen captures and sending that info out, enabling virus type apps...

Information for others .....Through Eclipse you can get a screen capture usig the DDMS perspective. If you take a look at the Eclipse DDMS code base its actually a stand-alone app too. You might be able to use this Java code then.

AdbHelper.getFrameBuffer(AndroidDebugBridge.getSocketAddress(), this);
like image 94
JPM Avatar answered Feb 21 '26 12:02

JPM