Skip to content

[Android] Add support for Android 14 Media Picker and partial photo access #29611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 21, 2025

Overview

This PR enhances the MediaPicker implementation for Android 14 (API level 34) to support two key features:

  1. Partial photo/video access using the new READ_MEDIA_VISUAL_USER_SELECTED permission
  2. Improved bottom sheet UI for selecting photos and videos directly from the current page

Changes

1. Added READ_MEDIA_VISUAL_USER_SELECTED permission support

  • Updated Permissions.Photos class to request the new permission on Android 14+
  • Added conditional permission check in PickAsync method

2. Improved UI experience for Android 14

  • Modified IntermediateActivity.StartAsync to detect Android 14+ and media picker requests
  • For Android 14+, bypassed the intermediate activity to prevent showing an empty transition page
  • Added direct activity result handling for media picker operations

3. Added developer integration helpers

  • Created HandleMediaPickerResult extension method for processing media picker results
  • Added documentation comments to explain the Android 14-specific handling

Developer Integration

App developers need to:

  1. Add the READ_MEDIA_VISUAL_USER_SELECTED permission to their AndroidManifest.xml
  2. Add the following code to their MainActivity:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent? data)
{
    if (!this.HandleMediaPickerResult(requestCode, resultCode, data))
    {
        base.OnActivityResult(requestCode, resultCode, data);
    }
}

Fixes #21071.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] [Android] MediaPicker in Android 14 [Android] Add support for Android 14 Media Picker and partial photo access May 21, 2025
@Copilot Copilot AI requested a review from mattleibow May 21, 2025 16:45
Copilot finished work on behalf of mattleibow May 21, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] MediaPicker in Android 14
2 participants