Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] android – VOLUME_EXTERNAL require API level 29

Posted on November 14, 2022

Solution 1 :

Even though MediaStore.VOLUME_EXTERNAL was added in API 29, but you are safe to use it as long as you set targetSdkVersion and compileSdkVersion to 29+. I have tested it on API 16 and this constant did not crash my app.

However, if you think this warning is pretty annoying, you can use MediaStore.<MediaType>.EXTERNAL_CONTENT_URI instead. It will return the same value as MediaStore.<MediaType>.getContentUri(MediaStore.VOLUME_EXTERNAL).

For instance, MediaStore.Downloads.EXTERNAL_CONTENT_URI will equal to MediaStore.Downloads.getContentUri(MediaStore.VOLUME_EXTERNAL), i.e. content://media/external/downloads.

Additionally, you can ignore this warning via @SuppressLint("InlinedApi").

Problem :

In Android documentation they said

On API <= 28, use VOLUME_EXTERNAL

but this also requires API level 29, and it doesn’t save media files into MediaStore.

 MediaStore.Audio.Media.IS_PENDING
 MediaStore.Video.Media.RELATIVE_PATH
 MediaStore.Video.Media.DATE_TAKEN

also requires API 29, So I feel the doc is not clear, or is there anything I missed?. And how do I save the media files in below Android 10 as well.

Comments

Comment posted by AndroidRuntimeException

I am blocked in the same part. I am trying to take a photo or select one from the gallery and set as profile but for some reason I am not able to figure out how works this. If you put val collection = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY) } else { MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL) } returns the same warning

Comment posted by Guilherme Santos

do you know if this is also true for the DATE_TAKEN and RELATIVE_PATH MediaColumns?

Comment posted by Akshay Kalola

MediaStore.<MediaType>.EXTERNAL_CONTENT_URI

Comment posted by Waqas Younis

Hey @AkshayKalola, you manage to find and solution for files?

READ  [ANSWERED] Android Studio Flutter project can not recognize GradleException and Properties in build.gradle
Powered by Inline Related Posts

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress