I am trying to create directory in Downloads folder using RNFetcBlob. It doesn't throw any error but folder doesn't get created....
This is the method I am using...
async createAppDir() {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
RNFetchBlob.fs.exists(GlobalVars.APPDIR)
.then((res) =>
{
if (!res) {
console.log("Creating App directory...", GlobalVars.APPDIR)
RNFetchBlob.fs.mkdir(GlobalVars.APPDIR)
.then((res) => {console.log("App directory created..")})
.catch((err) => {console.log(err)})
}
}
);
}
}
I have added permissions in AndroidManifest.xml..
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Console logs....
[Sat Jul 25 2020 10:16:30.966] LOG Creating App directory... /storage/emulated/0/Download/gifit/
[Sat Jul 25 2020 10:16:30.967] LOG App directory created..