MediaPicker.CapturePhotoAsync(MediaPickerOptions) Method

Definition

Opens the camera to take a photo.

public static System.Threading.Tasks.Task<Microsoft.Maui.Storage.FileResult?> CapturePhotoAsync(Microsoft.Maui.Media.MediaPickerOptions? options = default);
static member CapturePhotoAsync : Microsoft.Maui.Media.MediaPickerOptions -> System.Threading.Tasks.Task<Microsoft.Maui.Storage.FileResult>
Public Shared Function CapturePhotoAsync (Optional options As MediaPickerOptions = Nothing) As Task(Of FileResult)

Parameters

options
MediaPickerOptions

Pick options to use.

Returns

A FileResult object containing details of the captured photo. When the operation was cancelled by the user, this will return null.

Remarks

On Android, the operating system may destroy the app process while the system camera is foregrounded. Apps that need to recover MediaPicker results after process recreation should persist their own workflow state before starting capture and use the Android MediaPicker recovery APIs after startup or resume.

Applies to