Problem with MediaProjection and permission dialog
Hi
Im new to oculus development (Oculus Quest 2) and im trying simple app for making screenshots and screen recording. But im having a problem with permission to retrieve MediaProjectionApi
I start activity for result, and the standard android dialog for permission shows but, but without allow/deny buttons, so im stuck.
MediaProjectionPermissionDialog
This is the dialog, sorry for the phone pic, but build in screenshot does not show this dialog.
Found simmilar issue here https://github.com/rom1v/sndcpy/issues/75 but no solution either.
My code for showing this dialog. This is in my MainActivity and the testMediaProjectionPermission method is call as onClickListener from a button.
ActivityResultLauncher<Intent> resultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult> () {
@Override
public void onActivityResult(ActivityResult result) {
if(RESULT_OK == result.getResultCode()) {
Log.d(TAG, "Media projection permission granted");
MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE);
MediaProjection mediaProjection = mediaProjectionManager.getMediaProjection(result.getResultCode(), result.getData());
Log.d(TAG, "Successfully retrieved mediPerojeciton="+mediaProjection);
}
}
});
private void testMediaProjectionPermission(View view) {
MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE);
resultLauncher.launch(mediaProjectionManager.createScreenCaptureIntent());
}
Any advice would be appriciated. Any kind of workaround or another option to record screen other then the build in caster.
