我可以使用android MediaProjection api和MediaRecorder API捕获屏幕上的所有内容。当我第一次尝试捕获时,它会自动提示许可。我想手动获取Marshmallow的许可。我如何手动取得许可?可能吗?
下面的链接说它提示createScreenCaptureIntent()方法调用的权限。我已经实施了,但需要在开始我的需要之前明确地获得许可。
https://commonsware.com/Android/previews/screenshots-and-screen-recordings
虽然我们打电话
startActivityForResult(mediaProjectionManager.createScreenCaptureIntent(), REQUEST_CODE_SCREEN_RECORDING);
它转移呼叫
onActivityResult(Intent intent, int requestcode, int resultcode)
如果resultcode
没问题,MediaRecorder
,mediaProjecttionManager
和VirtualDisplay
不为空,那么我们可以说我们获得了屏幕许可,否则mediaPorjection
和VirtualDisplay
的值将为null