MediaStore.GetMediaUri(Context, Uri) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Return a MediaStore Uri that is an equivalent to the given
DocumentsProvider Uri.
[Android.Runtime.Register("getMediaUri", "(Landroid/content/Context;Landroid/net/Uri;)Landroid/net/Uri;", "", ApiSince=29)]
public static Android.Net.Uri? GetMediaUri(Android.Content.Context context, Android.Net.Uri documentUri);
[<Android.Runtime.Register("getMediaUri", "(Landroid/content/Context;Landroid/net/Uri;)Landroid/net/Uri;", "", ApiSince=29)>]
static member GetMediaUri : Android.Content.Context * Android.Net.Uri -> Android.Net.Uri
Parameters
- context
- Context
- documentUri
- Uri
The DocumentsProvider Uri to convert.
Returns
An equivalent MediaStore Uri. Returns null if no
equivalent was found.
- Attributes
Remarks
Return a MediaStore Uri that is an equivalent to the given DocumentsProvider Uri. This only supports ExternalStorageProvider and MediaDocumentsProvider Uris.
This allows apps with Storage Access Framework permissions to convert between MediaStore and DocumentsProvider Uris that refer to the same underlying item. Note that this method doesn't grant any new permissions, but it grants the same access to the Media Store Uri as the caller has to the given DocumentsProvider Uri; callers must already hold permissions for documentUri obtained with Intent#ACTION_OPEN_DOCUMENT or related APIs.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.