-1

I know there are ways to take screenshot programmatically.
1. use MonkeyRunner through ADB and use USB cable for connection between PC and Android device.
http://developer.android.com/tools/help/MonkeyDevice.html#takeSnapshot
2. get from drawing cache for your developed APP only
https://stackoverflow.com/a/24280494/2080233
3. get from frame buffer, but not work for many app.
http://www.pocketmagic.net/android-native-screen-capture-application-using-the-framebuffer/
4. use /system/bin/screencap by root, but need to write into storage.
https://stackoverflow.com/a/15208592/2080233

I want to know if there is a way to grab a screenshot directly from memory and work great.

Community
  • 1
  • 1
Season
  • 1,178
  • 2
  • 22
  • 42

1 Answers1

0

Your analysis of #4 is not quite accurate, as the usage information for screencap states:

If FILENAME is not given, the results will be printed to stdout

Therefore if you can invoke screencap as a user with sufficient permissions, you can capture the output of the process and do whatever you like with that data.

I believe this is what the screenshot button in DDMS ultimately does, piping the data back through the adb connection. Note however that if you pass binary data by way of ADB's standard output, you may have to undo a CRLF translation inserted in dubious consideration of Windows users.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117