androidandroid-4.4-kitkatmediastoreandroid-10.0

Is MediaStore.MediaColumns#DATE_TAKEN only available from API level 29?


I am trying to use MediaStore.Images.Media.DATE_TAKEN and getting warning from Android Studio IDE that it requires API 29 (Android Q). The official Google documentation here says this was Added in API level 29. Is this really true?

I've checked the Google Sources from past releases all the way back until API 19 (KitKat) and I saw MediaStore.MediaColumns#DATE_TAKEN field being available since then. Why is the official documentation saying something different?

Android 4.4 (KitKat) MediaStore

Android 5.0 (Lollipop) MediaStore

Android 6.0 (Marshmallow) MediaStore

Android 7.0 (Nougat) MediaStore

Android 8.0 (Oreo) MediaStore

Android 9.0 (Pie) MediaStore

Can someone please clarify the truth? Can I reliably use MediaStore.Images.Media.DATE_TAKEN from API 19+? Thanks!


Solution

  • Thanks to this answer.

    From the Api diff for level 29, we can see that DATE_TAKEN has always been there, even if the api level is below 29. The only difference is that before Android Q this const was in MediaStore.Images.ImageColumns but was moved to MediaStore.MediaColumns by now. Meanwhile ImageColumns extends MediaColumns. So the lint cannot identify them accurately.

    However, the value itself does not change before and after the move. So you can just ignore the warning.