Xamarin.MediaGallery 3.0.0

dotnet add package Xamarin.MediaGallery --version 3.0.0
                    
NuGet\Install-Package Xamarin.MediaGallery -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xamarin.MediaGallery" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xamarin.MediaGallery" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Xamarin.MediaGallery" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xamarin.MediaGallery --version 3.0.0
                    
#r "nuget: Xamarin.MediaGallery, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xamarin.MediaGallery@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xamarin.MediaGallery&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Xamarin.MediaGallery&version=3.0.0
                    
Install as a Cake Tool

MediaGallery for .NET Android and iOS (MAUI)

A .NET MAUI library for picking, saving, and capturing media files (photos and videos) using native platform APIs on Android and iOS.

Available Platforms

Platform Minimum OS Version TargetFramework
Android 5.0 (API 21) net8.0-android
iOS 13.6 net8.0-ios

Features

  • PickAsync — pick one or multiple photos/videos from the native gallery. Supports Android Photo Picker (API 33+), selection limit, cancellation token, and iPad popover positioning via PresentationSourceBounds
  • SaveAsync — save media files to the device gallery from Stream, byte[], or a local file path. Requires SaveMediaPermission
  • CapturePhotoAsync — capture a photo using the device camera with full EXIF metadata preserved. Requires Permissions.Camera
  • CheckCapturePhotoSupport — check if the device supports camera capture
  • SaveMediaPermission — built-in permission class for NSPhotoLibraryAddUsageDescription (iOS) and WRITE_EXTERNAL_STORAGE (Android < 10)

Public API

namespace NativeMedia;

// Pick media files
Task<MediaPickResult> MediaGallery.PickAsync(int selectionLimit = 1, params MediaFileType[] types)
Task<MediaPickResult> MediaGallery.PickAsync(MediaPickRequest request, CancellationToken token = default)

// Save media files
Task MediaGallery.SaveAsync(MediaFileType type, Stream fileStream, string fileName)
Task MediaGallery.SaveAsync(MediaFileType type, byte[] data, string fileName)
Task MediaGallery.SaveAsync(MediaFileType type, string filePath)

// Capture photo
bool MediaGallery.CheckCapturePhotoSupport()
Task<IMediaFile> MediaGallery.CapturePhotoAsync(CancellationToken token = default)

// Media file interface
interface IMediaFile : IDisposable {
    string NameWithoutExtension { get; }
    string Extension { get; }
    string ContentType { get; }
    MediaFileType? Type { get; }
    Task<Stream> OpenReadAsync();
}

// Pick request configuration
class MediaPickRequest {
    int SelectionLimit { get; }
    MediaFileType[] Types { get; }
    string Title { get; set; }
    Rect? PresentationSourceBounds { get; set; }
}

enum MediaFileType { Image, Video }

Setup

Android — initialize in Activity.OnCreate and forward OnActivityResult:

NativeMedia.Platform.Init(this, savedInstanceState);
NativeMedia.Platform.OnActivityResult(requestCode, resultCode, intent);

iOS (optional) — initialize in AppDelegate.FinishedLaunching:

NativeMedia.Platform.Init(GetTopViewController);

Full documentation, samples, and FAQ in the repository

Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net8.0-ios18.0 is compatible.  net9.0-android was computed.  net9.0-ios was computed.  net10.0-android was computed.  net10.0-ios was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Xamarin.MediaGallery:

Package Downloads
BitooBitImageEditorFix

Simple image editor for Xamarin Forms

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 10,340 4/2/2026
3.0.0-preview 7,754 11/5/2024
2.2.1 602,582 2/24/2023
2.2.1-preview 384 2/17/2023
2.2.0 77,820 1/6/2023
2.2.0-preview 484 12/6/2022
2.1.2 32,416 11/28/2022
2.1.2-alpha003 365 11/27/2022
2.1.2-alpha002 369 11/26/2022
2.1.2-alpha001 343 11/23/2022
2.1.1 137,112 12/18/2021
2.1.0 902 12/15/2021
2.1.0-preview1 905 12/12/2021
2.0.0 743 12/5/2021
2.0.0-preview4 343 12/4/2021
2.0.0-preview3 5,451 11/23/2021
2.0.0-preview2 514 11/22/2021
2.0.0-preview1 558 10/25/2021
2.0.0-preview 374 10/24/2021
1.0.2.2 16,837 9/22/2021
Loading failed