Open saadxprt opened 3 months ago
@saadxprt Pls Check the below Link for Android 13 Permissions Changelogs and Select the Suitable Answer for your Problem
@saadxprt Pls Check the below Link for Android 13 Permissions Changelogs and Select the Suitable Answer for your Problem
i did try to incorporate the appropriate permissions as per many answers, didnt work for me
Someone solved this ?
Hi I think that I have the solution to this bug, basically the viro library internally is reviewing the permissions but on sdk above to 33 we need to ask for other permissions types, so, I fixed recently if you create your own react viro version and make a local installation
After you clone the rect viro repository (https://github.com/viromedia/viro) you will need to add the follow lines inside the:
android -> viro_bridge -> java -> src -> module -> ARSceneNavigatorModule.java
search the line 331:
if (audioAndRecordingPerm){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
reactActivity.requestPermissions(new String[]{
Manifest.permission.READ_MEDIA_IMAGES,
Manifest.permission.READ_MEDIA_AUDIO,
Manifest.permission.READ_MEDIA_VIDEO,
Manifest.permission.RECORD_AUDIO
}, PERMISSION_REQ_CODE_AUDIO, listener);
} else {
reactActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.RECORD_AUDIO}, PERMISSION_REQ_CODE_AUDIO, listener);
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
reactActivity.requestPermissions(new String[]{
Manifest.permission.READ_MEDIA_IMAGES,
Manifest.permission.READ_MEDIA_AUDIO,
Manifest.permission.READ_MEDIA_VIDEO,
Manifest.permission.RECORD_AUDIO
}, PERMISSION_REQ_CODE_AUDIO, listener);
} else {
reactActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_REQ_CODE_STORAGE, listener);
}
}
private static boolean hasAudioAndRecordingPermissions(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
boolean hasReadMediaImagesPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_IMAGES") == 0;
boolean hasReadMediaAudioPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_AUDIO") == 0;
boolean hasReadMediaVideoPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_VIDEO") == 0;
return hasReadMediaImagesPermissions && hasReadMediaAudioPermissions && hasReadMediaVideoPermissions;
} else {
boolean hasRecordPermissions = ContextCompat.checkSelfPermission(context, "android.permission.RECORD_AUDIO") == 0;
boolean hasExternalStoragePerm = ContextCompat.checkSelfPermission(context, "android.permission.WRITE_EXTERNAL_STORAGE") == 0;
return hasRecordPermissions && hasExternalStoragePerm;
}
}
Basically that's the issue because it is reviewing internally the permissions before record I tested this and the recording it's working properly, I would help you. Would be great if some contributor could add this changes and thanks to @doranteseduardo he explain me how I can make my local viro version
Hi I think that I have the solution to this bug, basically the viro library internally is reviewing the permissions but on sdk above to 33 we need to ask for other permissions types, so, I fixed recently if you create your own react viro version and make a local installation
After you clone the rect viro repository (https://github.com/viromedia/viro) you will need to add the follow lines inside the:
android -> viro_bridge -> java -> src -> module -> ARSceneNavigatorModule.java
search the line 331:
if (audioAndRecordingPerm){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { reactActivity.requestPermissions(new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.RECORD_AUDIO }, PERMISSION_REQ_CODE_AUDIO, listener); } else { reactActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}, PERMISSION_REQ_CODE_AUDIO, listener); } } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { reactActivity.requestPermissions(new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.RECORD_AUDIO }, PERMISSION_REQ_CODE_AUDIO, listener); } else { reactActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQ_CODE_STORAGE, listener); } } private static boolean hasAudioAndRecordingPermissions(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { boolean hasReadMediaImagesPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_IMAGES") == 0; boolean hasReadMediaAudioPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_AUDIO") == 0; boolean hasReadMediaVideoPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_VIDEO") == 0; return hasReadMediaImagesPermissions && hasReadMediaAudioPermissions && hasReadMediaVideoPermissions; } else { boolean hasRecordPermissions = ContextCompat.checkSelfPermission(context, "android.permission.RECORD_AUDIO") == 0; boolean hasExternalStoragePerm = ContextCompat.checkSelfPermission(context, "android.permission.WRITE_EXTERNAL_STORAGE") == 0; return hasRecordPermissions && hasExternalStoragePerm; } }
Basically that's the issue because it is reviewing internally the permissions before record I tested this and the recording it's working properly, I would help you. Would be great if some contributor could add this changes and thanks to @doranteseduardo he explain me how I can make my local viro version
could you share us the full code file how to replace this,. because I'm not able to make it work, by using your instruction. thanks.
Any fix for this in the lib please
Any fix for this in the lib please
For android 14 or latter. You can just follow the @fernandoamz for the viro repo. Also, you need to fix the permission in the virocore repository. After you fix the permission issue, you need to rebuild the .aar file. Then you need to rebuild the package. To re build the .aar file you can just follow the readme instruction in virocore repository. To rebuild the react viro package just follow the documentation in react vision documentation site.
If you just build the project for experimental you can just force the permission check to returning true. 😁
Thanks, I will check this
@naufanituharish I can't build the local version after following the instructions on react vision documentation site
@naufanituharish I can't build the local version after following the instructions on react vision documentation site
Could you share the error message?
Hi I think that I have the solution to this bug, basically the viro library internally is reviewing the permissions but on sdk above to 33 we need to ask for other permissions types, so, I fixed recently if you create your own react viro version and make a local installation
After you clone the rect viro repository (https://github.com/viromedia/viro) you will need to add the follow lines inside the:
android -> viro_bridge -> java -> src -> module -> ARSceneNavigatorModule.java
search the line 331:
if (audioAndRecordingPerm){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { reactActivity.requestPermissions(new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.RECORD_AUDIO }, PERMISSION_REQ_CODE_AUDIO, listener); } else { reactActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}, PERMISSION_REQ_CODE_AUDIO, listener); } } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { reactActivity.requestPermissions(new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.RECORD_AUDIO }, PERMISSION_REQ_CODE_AUDIO, listener); } else { reactActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQ_CODE_STORAGE, listener); } } private static boolean hasAudioAndRecordingPermissions(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { boolean hasReadMediaImagesPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_IMAGES") == 0; boolean hasReadMediaAudioPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_AUDIO") == 0; boolean hasReadMediaVideoPermissions = ContextCompat.checkSelfPermission(context, "android.permission.READ_MEDIA_VIDEO") == 0; return hasReadMediaImagesPermissions && hasReadMediaAudioPermissions && hasReadMediaVideoPermissions; } else { boolean hasRecordPermissions = ContextCompat.checkSelfPermission(context, "android.permission.RECORD_AUDIO") == 0; boolean hasExternalStoragePerm = ContextCompat.checkSelfPermission(context, "android.permission.WRITE_EXTERNAL_STORAGE") == 0; return hasRecordPermissions && hasExternalStoragePerm; } }
Basically that's the issue because it is reviewing internally the permissions before record I tested this and the recording it's working properly, I would help you. Would be great if some contributor could add this changes and thanks to @doranteseduardo he explain me how I can make my local viro version
Can you please share intructions here how to build this locally so I can use it with my project?
Edit: I have forked the repo and its in my package.json with that updated code shared above
"@reactvision/react-viro": "github:saadxprt/viro"
but looks like i also have to
cd android
./gradlew :viroreact:assembleRelease
but this part is not working for me im getting an error
* What went wrong:
Cannot locate tasks that match ':viroreact:assembleRelease' as project 'viroreact' not found in root project 'reactnativestarter'.
environment:
Windows Android 13 actual device @viro-community/react-viro": "^2.41.1", "react-native": "0.72.6", Infinix Zero 30
it returns
{"errorCode": 1, "success": false, "url": null}
This is working fine with android 12 with these permissionsawait request('android.permission.WRITE_EXTERNAL_STORAGE'); ` what do I need to do in order to make this _startVideoRecording work with Android 13? or just store the recording anywhere on the phone which I can access