Skip to content

fix: add ClipData for Android 10+ share sheet image preview#121

Merged
Choochmeque merged 1 commit intoChoochmeque:mainfrom
pumpitbetter:fix/clipdata-android10
Mar 14, 2026
Merged

fix: add ClipData for Android 10+ share sheet image preview#121
Choochmeque merged 1 commit intoChoochmeque:mainfrom
pumpitbetter:fix/clipdata-android10

Conversation

@pumpitbetter
Copy link

@pumpitbetter pumpitbetter commented Mar 13, 2026

Android 10+ (API 29+) requires ClipData to be set on the share Intent for the native share sheet to render an image thumbnail. Without it, the share sheet opens correctly but shows no preview image.

Root cause: Android's share sheet on API 29+ ignores EXTRA_STREAM for thumbnail rendering unless a matching ClipData is also attached to the Intent.

Fix: Set clipData on the intent with the same URI and MIME type that is already passed via EXTRA_STREAM:

sendIntent.clipData = ClipData.newUri(activity.contentResolver, args.title ?: "", contentUri)

Tested on Android 13 (API 33). Share sheet now shows the image thumbnail as expected.

Android 10+ requires ClipData to be set on the share Intent for the
native share sheet to render an image thumbnail. Without it the sheet
opens but shows no preview image.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Android share plugin to improve share sheet UX when sharing files by enabling thumbnail previews via ClipData.

Changes:

  • Add ClipData to the file-sharing intent so Android’s share sheet can display a preview thumbnail (esp. on Android 10+).
  • Add the required ClipData import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 6 to 7
import android.content.pm.PackageManager
import android.os.Build
@Choochmeque Choochmeque merged commit f5a3a34 into Choochmeque:main Mar 14, 2026
16 checks passed
@Choochmeque
Copy link
Owner

Merged. Thank you!

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.

3 participants