MediaStore - BUCKET_DISPLAY_NAME only present on API 29+?
Asked Answered
S

1

12

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.

Sharonsharona answered 2/9, 2019 at 16:26 Comment(0)
S
10

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.

Sharonsharona answered 2/9, 2019 at 20:0 Comment(3)
I wonder if Google is doing something to avoid confusions like this.Epictetus
Thanks! We got similar case with MediaStore.Images.ImageColumns.ORIENTATION changed to MediaStore.MediaColumns.ORIENTATION. Did you find any clean solution for this?Carve
I am facing a similar problem with MediaStore.Audio.Media.BUCKET_DISPLAY_NAME Can anyone here help me please?Vexillum

© 2022 - 2024 — McMap. All rights reserved.