Even after calling
let dir = await ScopedStorage.openDocumentTree(true)
and getting permission to specific directory it doesn't allow to read file but can be write without any problem.
Using same uri which i got from writing if I use that to read it gives me the permission error. Below I have provided my code snippet.
Error: 'content://com.android.externalstorage.documents/document/primary%3ADocuments%2F.hkbackup%2F.hkbackup%2Fdata-01758515157'does not have permission to read/write
at Object.promiseMethodWrapper [as readFile] (D:\Nanoid\halkhata-app\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:103)
at Object. (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:128)
at step (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:32)
at Object.next (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:13)
at D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:7
at tryCallTwo (D:\Nanoid\halkhata-app\node_modules\react-native\node_modules\promise\setimmediate\core.js:45)
at doResolve (D:\Nanoid\halkhata-app\node_modules\react-native\node_modules\promise\setimmediate\core.js:200)
at new Promise (D:\Nanoid\halkhata-app\node_modules\react-native\node_modules\promise\setimmediate\core.js:66)
at __awaiter (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:3)
at Object.readFile (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:125)
I got it working! this is pretty weird you have to provide exact uri which you got during write. I was trying to provide uri which I received from ScopedStorage.openDocument call.
Even after calling
let dir = await ScopedStorage.openDocumentTree(true)
and getting permission to specific directory it doesn't allow to read file but can be write without any problem. Using same uri which i got from writing if I use that to read it gives me the permission error. Below I have provided my code snippet.Error given below
console.log('===============error=====================');
Error: 'content://com.android.externalstorage.documents/document/primary%3ADocuments%2F.hkbackup%2F.hkbackup%2Fdata-01758515157'does not have permission to read/write at Object.promiseMethodWrapper [as readFile] (D:\Nanoid\halkhata-app\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:103) at Object. (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:128)
at step (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:32)
at Object.next (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:13)
at D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:7
at tryCallTwo (D:\Nanoid\halkhata-app\node_modules\react-native\node_modules\promise\setimmediate\core.js:45)
at doResolve (D:\Nanoid\halkhata-app\node_modules\react-native\node_modules\promise\setimmediate\core.js:200)
at new Promise (D:\Nanoid\halkhata-app\node_modules\react-native\node_modules\promise\setimmediate\core.js:66)
at __awaiter (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:3)
at Object.readFile (D:\Nanoid\halkhata-app\node_modules\react-native-scoped-storage\dist\index.js:125)
console.log('==============error======================');