Skip to content

Rework the custom targets sharesheet snippet - #1063

Open
hamen wants to merge 2 commits into
android:mainfrom
StellarElements:sharesheet-custom-targets
Open

Rework the custom targets sharesheet snippet#1063
hamen wants to merge 2 commits into
android:mainfrom
StellarElements:sharesheet-custom-targets

Conversation

@hamen

@hamen hamen commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Reworks the android_provide_custom_targets snippet used by the "Add custom targets" section of https://developer.android.com/develop/ui/compose/sharing/send#adding-custom-targets.

The snippet on the page builds two ChooserTarget instances and passes them through EXTRA_CHOOSER_TARGETS. ChooserTarget has been deprecated since API level 30, and its documentation points to Direct Share targets instead. The section it illustrates is about EXTRA_INITIAL_INTENTS, so the ChooserTarget part was not needed to make the point.

What changed:

  • Removed the two ChooserTarget instances and the EXTRA_CHOOSER_TARGETS extra, along with the now unused ChooserTarget import.
  • Removed the double Intent.createChooser call. The old code wrapped an already-created chooser in a second chooser, which is not what the guide describes.
  • Reduced the initial intents from two to one, and gave it a name that reads as an example (CustomActivity) rather than pointing at Nearby Share and Maps.
  • Moved the region tags so the snippet shows only the chooser construction.

This deviates from the current page text, which still shows the ChooserTarget version. The page needs the same update.

@hamen
hamen marked this pull request as ready for review September 2, 2026 11:16
@hamen
hamen requested a review from a team as a code owner September 2, 2026 11:16
@snippet-bot

snippet-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.
You are about to delete 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

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