Search code examples
androidscreenshotprintscreen

How to programmatically take a screenshot in Android without root or adb?


as title says, im trying to figure out how to programmatically take a screenshot in android without root or adb, what about executing script or simulating android keyevents? im trying to find solution but no success.


Solution

  • On Android 5.0+, use the media projection APIs. They are somewhat under-documented. This sample project demonstrates how to take screenshots.

    On Android 4.4 and lower, this is not possible, outside of perhaps some security flaws on specific device models.