FileKit icon indicating copy to clipboard operation
FileKit copied to clipboard

File operation on Android

Open dhng22 opened this issue 6 months ago • 1 comments
trafficstars

Hi, thanks for the great library.

I've countered this issue on Android while allow user to delete/ overwrite a file from public external storage (music, video), it would throw SecurityException. Maybe we could have some funnction that allow a system-popup to show up and gain user acceptance then proceed the operation? I've figured out that this require the use of ContentResolver.delete/openOutputStream()

Many thanks!

dhng22 avatar May 18 '25 08:05 dhng22

Hi @dhng22! Thanks for creating this issue!

At first, I would suggest using an external library that will help you to request the permissions you need like:

  • Moko Permissions https://github.com/icerockdev/moko-permissions
  • Calf Permissions https://mohamedrejeb.github.io/Calf/permissions/

You will be able to request the permissions before trying to access / modify the file.

Does it solve your problem?

vinceglb avatar May 27 '25 00:05 vinceglb

@vinceglb Hi, sorry for the long reply, but unfortunately, the two libraries you suggested is not meant to access (modify/delete) content in scope storage, as I've mentioned earlier, it can only be achieved by ContentResolver.delete/openOutputStream()

dhng22 avatar Sep 17 '25 09:09 dhng22