Open anta40 opened 2 years ago
Hey, there used to be an older version of the Library where you could save Images in any Directory. However, Google broke this after Android 10.
[+] https://github.com/ihimanshurawat/ImageWorker/issues/4
So in order to make the experience consistent for all developers, I updated the library to store images in App's Directory.
Try - implementation "com.github.ihimanshurawat:ImageWorker:1.0.0"
Regarding your issue related to Images not visible in Gallery apps. This is because you require a function to be fired after the Image is saved.
From Activity's context, you need to call the function.
context.sendBroadcast(Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(file)))
I haven't been in touch with Android Development for a long time. You might have to cross-check if the above method still works.
Hope this helps. Let me know.
You can Fork the project and update as per your requirements :)
Applications like Whatsapp, Facebook, Twitter, Snapseed etc do this: they have their own directories inside Pictures directory, which means they are easily searchable via builtin photo gallery app, and sharing them via social medias are very easy, too.
This is my code to save image:
The full path is
/storage/emulator/0/Android/data/com.anta40.testapp/files/ImageWorker/SubDirectory/IMG12345.png
. The image is not shown on Photo gallery, and I worry common, non-tehnical users will freak out: "Hey where are my images?"Is there a way to automatically create ImageWorker directory inside Pictures, instead? I'm on Pixel 3 running stock Android 12, BTW.