0

I am writing a python script to process an image. I need to take automated screenshots. How can i do that with some kind of command ? No root acces. I am using termux and terminal emulator.

1
  • I did try imagemagick but it gives error Commented Oct 11, 2018 at 9:55

1 Answer 1

2

You would need elevated privileges, at least of user 2000 (shell) or higher. Since the Android is not rooted, your best bet is to get adb running in wireless mode in your device. You would also have to load a compatible adb binary for your Android to connect to localhost via adb.

Once this have been achieved, run

adb shell screencap /sdcard/FILE_NAME.png
2
  • Is this exclusively from adb? I tried from the actual phone (on 2 different devices) with a terminal app with $ screencap test.png and it generates a 0 byte file. The folder is writable, for example echo hello > test.txt does create a 6 byte file
    – golimar
    Commented May 18, 2022 at 8:10
  • 1
    Yes. You need adb. User installed (unprivileged) apps cannot capture screen without using dedicated API.
    – Firelord
    Commented May 18, 2022 at 10:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .