react-native-fs icon indicating copy to clipboard operation
react-native-fs copied to clipboard

unable to get dcim/camera files on android

Open qpavy opened this issue 2 years ago • 2 comments

Hello !

I try to use react-native-fs to get files from my android gallery (in /storage/emulated/0/dcim/camera folder). I already set those android permissions :

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and I try to access the file with this code :

async componentDidMount() {
  const path = RNFS.ExternalStorageDirectoryPath + '/dcim/camera';
  console.log('Document Path : ', path);
  const dir = await RNFS.readDir(path);
  console.log('DIR : ', dir);
}

Unfortunally, I don't succeed to retrieve the files. Here is the log :

LOG  Document Path :  /storage/emulated/0/dcim/camera
LOG  DIR :  []

If I try to list the /dcim files it works well :

LOG  Document Path :  /storage/emulated/0/dcim
LOG  DIR :  [{"ctime": null, "isDirectory": [Function isDirectory], "isFile": [Function isFile], "mtime": 2022-06-20T14:46:24.000Z, "name": "Camera", "path": "/storage/emulated/0/dcim/Camera", "size": 53248}, {"ctime": null, "isDirectory": [Function isDirectory], "isFile": [Function isFile], "mtime": 2021-05-03T00:04:15.000Z, "name": ".thumbnails", "path": "/storage/emulated/0/dcim/.thumbnails", "size": 24576}, {"ctime": null, "isDirectory": [Function isDirectory], "isFile": [Function isFile], "mtime": 2020-01-24T01:45:31.000Z, "name": ".tmfs", "path": "/storage/emulated/0/dcim/.tmfs", "size": 3488}, {"ctime": null, "isDirectory": [Function isDirectory], "isFile": [Function isFile], "mtime": 2022-06-21T12:55:14.000Z, "name": "Screenshots", "path": "/storage/emulated/0/dcim/Screenshots", "size": 118784}

Do you have some ideas why I can't retrieve camera files ?

Many thanks =)

qpavy avatar Jun 23 '22 02:06 qpavy

I am still Fucked Up with this Shitty Package. I thought using this can allow me to get the images from the /DCIM/Camera dir but you know the truth

S1D007 avatar Sep 25 '23 11:09 S1D007