I'd like to take screenshots on my android phone. I'm an app developer and have a pretty good understanding of the regular API, and I know this steps out of the "regular" thing quite a bit.
I would have root access.
I've seen a few apps that do this. I'm just wondering how one goes about doing it. Anybody know the genera开发者_StackOverflow中文版l direction I should be looking in?
Have a look at framebuffer.c in the adb (phone side) sources, which appears to be what the DDMS screenshot capability uses. You need to be uid root or gid graphics due to the permissions on the framebuffer device - presumably the adbd is the later.
It is in /platform/system/core
:
Direct link to the file: https://android.googlesource.com/platform/system/core/+/gingerbread-release/adb/framebuffer_service.c
drocap2 is usually what I have seen used (free app found in market). Alternatively, if you would like to take a screenshot from your PC, I know Motodev Studio has a plugin for this in their IDE (not sure if it is available for other eclipse based IDEs).
The simplest is get look in to the /system/bin/screencap
.
Since you have root access you can easily get rid of it without the overhead of reading and writing buffer.
精彩评论