cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

Media scanner after creating file

Open aligassan opened this issue 4 years ago • 8 comments

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

aligassan avatar Jan 25 '20 12:01 aligassan

Does this happen on android or ios? Or both?

breautek avatar Feb 14 '20 05:02 breautek

I actually i am working only on android . So its happen on android

aligassan avatar Feb 14 '20 07:02 aligassan

@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 avatar Aug 09 '20 13:08 arihantdaga

@arihantdaga , did you restart your phone after finish download ?

aligassan avatar Aug 09 '20 13:08 aligassan

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 avatar Aug 09 '20 14:08 arihantdaga

@arihantdaga try to check this answer please https://stackoverflow.com/a/53225840/8361759

aligassan avatar Aug 09 '20 14:08 aligassan

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.. :(

arihantdaga avatar Aug 09 '20 14:08 arihantdaga

I think they use download manager.

arihantdaga avatar Aug 09 '20 14:08 arihantdaga