Skip to content

Add a navDeepLink routing snippet for Receiving simple data - #1085

Open
hamen wants to merge 2 commits into
android:mainfrom
StellarElements:hamen/sharesheet-receive-deeplink
Open

hamen wants to merge 2 commits into
android:mainfrom
StellarElements:hamen/sharesheet-receive-deeplink

Conversation

@hamen

@hamen hamen commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Code snippets are for:

This lands with a receive.md edit, and the two have to ship together. The page edit is up on the google3 staging environment. Two of the three regions below no longer match the live page, on purpose, because the page is changing to match them.

The routing snippet was written at the page owners' request. A written brief went to them naming three findings on this page: the prose contradicting its only snippet, the two-step process being incomplete because navDeepLink routes but does not deliver EXTRA_STREAM or EXTRA_TEXT, and two sentences of View system text with no snippet behind them. They were offered the code following the prose or the prose following the code, and chose the first. The guide told the reader to route the incoming ACTION_SEND intent with Compose Navigation's deep link support, "instead of manually intercepting and parsing the Intent", and no navDeepLink code appeared anywhere on the page — the one snippet did exactly the manual interception the prose says to avoid.

List of modifications:

  • android_receive_data_nav_deeplink: new region, the missing routing step. Tagged around the composable(route = "incoming_share", ...) call alone, with no exclude blocks, so the page publishes that call and nothing else. It declares three links: ACTION_SEND with text/plain, ACTION_SEND with image/*, and ACTION_SEND_MULTIPLE with image/*. The third is there because the manifest declares that filter and SharesheetHandler handles it, so leaving it out would give a reader who follows steps 1 and 2 no route for multiple images.
  • android_handle_intent_action_data_sent: edited, and no longer verbatim against the live page. It carries the rewrite that ships with the receive.md edit — private handlers, Intent.ACTION_SEND in place of the bare imported ACTION_SEND, ?.let on the nullable image extras, and reworded comments. 46 lines here against the page's 43. spotlessApply moved nothing.
  • android_handle_intent_handle_extra_text: edited, one comment. It was 6/6 verbatim and is now 5/6, because the reworded comment collapses the page's two comment lines into one. That wording ships in receive.md with the rest.

Snippets not migrated:

  • The AndroidManifest.xml activity block with the ACTION_SEND intent filters. Manifest snippets are not migrated, so it stays hardcoded on the page.

One thing for the page while that manifest block is being edited: the activity declares intent filters and no android:exported, so as printed today it will not install on API level 31 or higher. It wants android:exported="true" to receive incoming share intents. That is a defect on the live page rather than a nicety.

Note on overlap: this touches the same file as #1063, which removes the ChooserTarget import and reworks customTargets(). The two overlap only in the import block; whichever lands second takes a one-line conflict there.

Add the navDeepLink routing snippet the Receiving simple data guide asks
for, and carry the handler rewrite that ships with the receive.md edit.
@hamen
hamen requested a review from a team as a code owner September 11, 2026 09:26
@hamen
hamen requested a review from bsagmoe September 11, 2026 09:26
@snippet-bot

snippet-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 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

Comment on lines 72 to 73
val context = LocalContext.current
val intent = (context as? Activity)?.intent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you could probably update this to use LocalActivity:

val activity = LocalActivity.current
val intent = activity?.intent

@hamen
hamen force-pushed the hamen/sharesheet-receive-deeplink branch from 8f673d3 to 5ef35f8 Compare September 16, 2026 15:31
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.

2 participants