File tree 1 file changed +15
-1
lines changed
android/src/main/java/com/alpha0010/fs
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,21 @@ class FileAccessModule(reactContext: ReactApplicationContext) : ReactContextBase
130
130
" audio" -> {
131
131
reactApplicationContext.contentResolver.insert(
132
132
MediaStore .Audio .Media .EXTERNAL_CONTENT_URI ,
133
- ContentValues ().apply { put(MediaStore .Audio .Media .DISPLAY_NAME , targetName) }
133
+ ContentValues ().apply {
134
+ put(MediaStore .Audio .Media .DISPLAY_NAME , targetName)
135
+
136
+ if (android.os.Build .VERSION .SDK_INT < android.os.Build .VERSION_CODES .Q ) {
137
+ // Older versions require path be specified.
138
+ @Suppress(" DEPRECATION" )
139
+ put(
140
+ MediaStore .Audio .AudioColumns .DATA ,
141
+ File (
142
+ Environment .getExternalStoragePublicDirectory(Environment .DIRECTORY_MUSIC ),
143
+ targetName
144
+ ).absolutePath
145
+ )
146
+ }
147
+ }
134
148
)
135
149
}
136
150
" images" -> {
You can’t perform that action at this time.
0 commit comments