permission of start capturing everything that display in my screen in android

3.8k views Asked by At

I can capture everything on my screen using android MediaProjection api along with MediaRecorder API. When i try to capture for the first time it prompt for permission automatically. I want to take permission manually for Marshmallow. How can i take permission manually ? is it possible?

The link below say that it prompt for permission on createScreenCaptureIntent() method call. I have implemented on my way but need to take permission explicitly before starting my need.

https://commonsware.com/Android/previews/screenshots-and-screen-recordings

1

There are 1 answers

0
Md. Sulayman On

While we call

startActivityForResult(mediaProjectionManager.createScreenCaptureIntent(), REQUEST_CODE_SCREEN_RECORDING);

it transfer call to

onActivityResult(Intent intent, int requestcode, int resultcode)

if resultcode is OK and MediaRecorder, mediaProjecttionManager and VirtualDisplay are not null, thhen we can say that we get capturing screen permission otherwise the value of mediaPorjection and VirtualDisplay will be null