Open ChetanPatelSS opened 1 year ago
@ChetanPatelSS
You could try this:
const fileName = 'SomeFileName.ext';
const filePath = `${ReactNativeBlobUtil.fs.dirs.DocumentDir}/${fileName}`;
ReactNativeBlobUtil.MediaCollection.copyToMediaStore(
{
name: fileName,
parentFolder: '',
mimeType: 'application/octet-stream',
},
'Download',
filePath
);
It works for Android 13. For Android < 13 you could use:
ReactNativeBlobUtil.fs.writeFile(filePath, base64Content, 'base64');
Doesn't work
'error from', [Error: No such file ('/data/user/0/com.bletest/files/0e072505-d1d3-40b5-8b1a-e2123dc205a9.jpg')]```
For Android 13 RNFetchUtil.fs.dirs.DocumentDir
👍
You could try this:
let file_path = Platform.Version < 31 ? RNFetchUtil.fs.dirs.DownloadDir : RNFetchUtil.fs.dirs.DocumentDir + '/informe.pdf';
Try adding the below lines in your AndroidManifest.xml
And Inside in the application tag,
<application .......................... ............................ android:requestLegacyExternalStorage="true">
@ChetanPatelSS Did you find a solution for this issue?
@FranciscoMendes10866 I assume you can reproduce it. Can you please test if removing or changing any of the options works? For my app in production without download manager etc I don't have any problems.
So I assume it is either media scannable or the path for the downloadmanager. With newer android versions media scannable likely has no effect regardless.
Downloading file, it's not working on Android 13 devices at all anymore
I tried to write a file to RNFetchBlob.fs.dirs.DownloadDir but it always returns Permission Denied. After digging a bit more into it turns out Android 13 introduce a new storage paradigm called.
Sample code try { // Request permission to write to external storage (Android-specific) const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,{ title: 'storage title', message: 'storage_permission', buttonPositive: 'ok', } );