Android.Content.Intent.ActionOpenDocument Field
Activity Action: Allow the user to select and return one or more existing documents.

Syntax

[Android.Runtime.Register("ACTION_OPEN_DOCUMENT")]
public const string ActionOpenDocument

See Also

Android.Provider.DocumentsContract
Intent.ActionOpenDocumentTree
Intent.ActionCreateDocument

Remarks

Activity Action: Allow the user to select and return one or more existing documents. When invoked, the system will display the various Android.Provider.DocumentsProvider instances installed on the device, letting the user interactively navigate through them. These documents include local media, such as photos and video, and documents provided by installed cloud storage providers.

Each document is represented as a content:// URI backed by a Android.Provider.DocumentsProvider, which can be opened as a stream with ContentResolver.OpenFileDescriptor(Android.Net.Uri, System.String), or queried for NoType:android/provider/DocumentsContract$Document;Href=../../../reference/android/provider/DocumentsContract.Document.html metadata.

All selected documents are returned to the calling application with persistable read and write permission grants. If you want to maintain access to the documents across device reboots, you need to explicitly take the persistable permissions using ContentResolver.TakePersistableUriPermission(Android.Net.Uri, Android.Content.ActivityFlags).

Callers must indicate the acceptable document MIME types through Intent.SetType(string). For example, to select photos, use image/*. If multiple disjoint MIME types are acceptable, define them in Intent.ExtraMimeTypes and Intent.SetType(string) to */*.

If the caller can handle multiple returned items (the user performing multiple selection), then you can specify Intent.ExtraAllowMultiple to indicate this.

Callers must include Intent.CategoryOpenable in the Intent so that returned URIs can be opened with ContentResolver.OpenFileDescriptor(Android.Net.Uri, System.String).

Output: The URI of the item that was picked, returned in Intent.Data. This must be a content:// URI so that any receiver can access it. If multiple documents were selected, they are returned in Intent.ClipData.

[Android Documentation]

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1