Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Fix MediaPicker capture methods in Android 13+
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow authored Jan 23, 2023
1 parent 93f775d commit 4ae3e5e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Xamarin.Essentials/MediaPicker/MediaPicker.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ static Task<FileResult> PlatformCaptureVideoAsync(MediaPickerOptions options)
static async Task<FileResult> PlatformCaptureAsync(MediaPickerOptions options, bool photo)
{
await Permissions.EnsureGrantedAsync<Permissions.Camera>();
await Permissions.EnsureGrantedAsync<Permissions.StorageWrite>();
// StorageWrite no longer exists starting from Android API 33
if (!OperatingSystem.IsAndroidVersionAtLeast(33))
await Permissions.EnsureGrantedAsync<Permissions.StorageWrite>();

var capturePhotoIntent = new Intent(photo ? MediaStore.ActionImageCapture : MediaStore.ActionVideoCapture);

Expand Down

0 comments on commit 4ae3e5e

Please sign in to comment.