cordova-plugin-file
cordova-plugin-file copied to clipboard
Media scanner after creating file
Issue Type
- [ ] Bug Report
- [x ] Feature Request
- [ ] Support Question
Description
After i have finished downloading media or capturing the image and video file on my app . The media doesn't shows in gallery as image or video . So i have to restart my app then media will shows in gallery . So i have feature request to add media scanner After capturing or downloading media without restarting phone .
Thank you
Does this happen on android or ios? Or both?
I actually i am working only on android . So its happen on android
@aligassan I am trying to download file and i am very confused about the storage types. I tried this.file.externalDataDirectory and this.file.dataDirectory. But in any case, the downloaded file just doesn't show up in the gallery. Can you share, what did you use to store the file ?
@arihantdaga , did you restart your phone after finish download ?
Noh, But when i am using the dataStorage directory like this -
const entry = await fileTransfer.download(url, this.file.externalDataDirectory + '/Download/' + options.name);
It goes into file:///storage/emulated/0/Android/data/com.feturtles.theopendiaries/files/Download/2efd2aa10701f6f493dd3d0ab77325b8_1595875789984.jpeg
But i want to store it into Downloads directory or Pictures/myAppName directory. I tried using externalRootDirectory + '/Download' instead, but then i am getting permission error, even after requesting permission for write_storage.
I have searched on Internet, the whole day and i haven't yet found how to perfectly download an image to the phone.. :(
@arihantdaga try to check this answer please https://stackoverflow.com/a/53225840/8361759
I tried the same thing, tried with bith read permission and write permission, this returs true, like permission granted, but the filetransfer actually fails.
I suspect that this could also be a problem in android 10. Since recently they startee enforcing storage access framework. But then i dont know how other apps are working.. :(
I think they use download manager.