• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Taking Screenshot on Android Smartphones Locally via Python (Without a second smartphone, PC, Wifi or USB Connection)

Emregun

Lurker
May 9, 2023
1
0
Hi All,

I want to take screenshots of my Android smartphone screen(not only screenshot of my app but whole screen) locally in background (without a second smartphone, PC , Wifi or USB connection) in my application via Python, but unfortunately I could not find a proper way to do it. I tried following methods but none of them is the right way in my case:

Android Screen Buffer: I guess this is used for screenshot, but I could not achieve to install it. I get following error:
The conflict is caused by: ash 0.3, 0.2 and 0.1 depends on opencv-python==4.1.2.30
but this version does not support any arm base platform. So I cannot install it. Moreover it has also dependencies with ADB tool,
so it looks like wifi or serial connection required.

ADB(Android Debug Bridge Tool): It requires either USB Cable or Wifi connection. The problem is that I do not want that my app users
requires necessary the same Wifi connection(I know internet connection not required but they need to be somewhere around a modem) to be able to use my app.

LADB: This requires also USB Cable or Wifi connection

scrcpy: It has also ADB dependencies. I get no devices/emulators found if I do not start any server from a PC.

Note: I want to implement it necessarily via Python with the reason that the implementation is already done for Windows and MacOS via Cross Platform Python. But if it is impossible with Python is there any other way? if it is so, then which language and library would you recommend? I found some examples via Java but all of them were screen capturing the window within the application not whole smartphone screen.

Thanks a lot in advance.

Environment: Android 11
Prog Language: Python 3.7
Smartphone:Samsung Galaxy A8
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones