Freigeben über


MediaStore.GetDocumentUri(Context, Uri) Method

Definition

Return a DocumentsProvider Uri that is an equivalent to the given MediaStore Uri.

[Android.Runtime.Register("getDocumentUri", "(Landroid/content/Context;Landroid/net/Uri;)Landroid/net/Uri;", "", ApiSince=26)]
public static Android.Net.Uri? GetDocumentUri (Android.Content.Context context, Android.Net.Uri mediaUri);
[<Android.Runtime.Register("getDocumentUri", "(Landroid/content/Context;Landroid/net/Uri;)Landroid/net/Uri;", "", ApiSince=26)>]
static member GetDocumentUri : Android.Content.Context * Android.Net.Uri -> Android.Net.Uri

Parameters

context
Context
mediaUri
Uri

The MediaStore Uri to convert.

Returns

Uri

An equivalent DocumentsProvider Uri. Returns null if no equivalent was found.

Attributes

Remarks

Return a DocumentsProvider Uri that is an equivalent to the given MediaStore Uri.

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; callers must already hold permissions obtained with Intent#ACTION_OPEN_DOCUMENT or related APIs.

Java documentation for android.provider.MediaStore.getDocumentUri(android.content.Context, android.net.Uri).

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.

Applies to