-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android): update max sdk version for write external storage #547
Conversation
Confirmed that this library does not work on Android 11 and 12 without this change. Adding the patch below fixes it. Thanks for the tip @bang9 npx patch-package react-native-audio-recorder-player diff --git a/node_modules/react-native-audio-recorder-player/android/src/main/java/com/dooboolab.audiorecorderplayer/RNAudioRecorderPlayerModule.kt b/node_modules/react-native-audio-recorder-player/android/src/main/java/com/dooboolab.audiorecorderplayer/RNAudioRecorderPlayerModule.kt
index 5cb9bbf..46d973a 100644
--- a/node_modules/react-native-audio-recorder-player/android/src/main/java/com/dooboolab.audiorecorderplayer/RNAudioRecorderPlayerModule.kt
+++ b/node_modules/react-native-audio-recorder-player/android/src/main/java/com/dooboolab.audiorecorderplayer/RNAudioRecorderPlayerModule.kt
@@ -38,9 +38,10 @@ class RNAudioRecorderPlayerModule(private val reactContext: ReactApplicationCont
fun startRecorder(path: String, audioSet: ReadableMap?, meteringEnabled: Boolean, promise: Promise) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- // TIRAMISU (33)
- // https://github.com/hyochan/react-native-audio-recorder-player/issues/503
- if (Build.VERSION.SDK_INT < 33 &&
+ // On devices that run Android 10 (API level 29) or higher
+ // your app can contribute to well-defined media collections such as MediaStore.Downloads without requesting any storage-related permissions
+ // https://developer.android.com/about/versions/11/privacy/storage#permissions-target-11
+ if (Build.VERSION.SDK_INT < 29 &&
(ActivityCompat.checkSelfPermission(reactContext, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED ||
ActivityCompat.checkSelfPermission(reactContext, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)) {
ActivityCompat.requestPermissions((currentActivity)!!, arrayOf(
|
Does it work Now? |
Why is it not merged yet? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bang9 Thank you for helping others out! 👍
Hello, If the version of device is Android 10 or higher, no longer need the "write external storage" permission.
You can read more by following this link:
https://developer.android.com/about/versions/11/privacy/storage#permissions-target-11
resolve #544