I was planning to query the MediaStore.Images.Media.BUCKET_DISPLAY_NAME field, but Android Studio says it's only available on API 29+. Also, the Android docs say the same.
However, I have found this StackOverflow post from 2017 when they used this same field.
What am I missing here?
Thank you.
EDIT: I also tried it on an Android 9.0 emulator and it works just fine.
The filesystem and mediastore modules are deprecated. You should use the new storage module which is relying on Okio Filesystem API. On Android, every files on the shared storage (files visible when using a file manager) are indexed by MediaStore, to allow apps to query them by type, date, size, etc.
added to API level 29 String BUCKET_DISPLAY_NAME The bucket display name of the image. This is a read-only property that is automatically computed from the DATA column.
android.provider.MediaStore. The contract between the media provider and applications. Contains definitions for the supported URIs and columns. The media provider provides an indexed collection of common media types, such as Audio , Video , and Images , from any attached storage devices.
When looking at the API diff and the current MediaStore source, we can see that until Android 10 (API 29), BUCKET_DISPLAY_NAME
was declared inside of MediaStore.Images.ImageColumns
. On API 29 this property was moved to MediaStore.MediaColumns
(which MediaStore.Images.ImageColumns
implements), but the actual value of the constant it's the same.
So it seems it was simply moved to the parent interface, but its value is the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With