Programatically running : getRuntime.exec("screencap", "-p /sdcard/image.png")
does not do anything except exiting with code=1
.
But when USB debugging, running that same command from pc in cmd: adb shell screencap -p /sdcard/dddd.png
works.
From previous stackoverflow posts, It seems that programatcially running that command doesn't work because the app does not have permission, and this requires rooting the phone to give su access to the app.
Why does running these commands from the pc doesn't require privileged access ?