What is MediaStore.Images.Media.getContentUri (String volumeName): Uri?

Public methods for the Content Provider Media API look pretty straightforward to me, except for that. I'm not sure what this does or how to use it. Any understanding of use will be appreciated.

+4
source share
2 answers

I think that the volume names "external" and "internal" refer to the external (sdcard) and internal locations for the media. Each of the Media subcontainers has this.

They also have a static constant for internal and External URIs, which are probably preferable to use in getContentUri(volumeName)

those. I would have thought (but I have not confirmed) that

MediaStore.Images.Media.getContentUri("external").equals(MediaStore.Images.Media.EXTERNAL_CONTENT_URI)

+3
source

You use "internal" for INTERNAL_CONTENT_URI and "external" for EXTERNAL_CONTENT_URI , as shown in the source code:

  /** * Get the content:// style URI for the image media table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the image media table on the given volume */ public static Uri getContentUri(String volumeName) { return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/images/media"); } /** * The content:// style URI for the internal storage. */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); /** * The content:// style URI for the "primary" external storage * volume. */ public static final Uri EXTERNAL_CONTENT_URI = getContentUri("external"); 

CONTENT_AUTHORITY_SLASH not worse than content://media/ .

 public static final String AUTHORITY = "media"; private static final String CONTENT_AUTHORITY_SLASH = "content://" + AUTHORITY + "/"; 
+2
source

Source: https://habr.com/ru/post/1392132/


All Articles