Skip to content

Add remaning notification snippets for d.android.com#933

Merged
alabiaga merged 4 commits into
android:mainfrom
alabiaga:main
Jun 2, 2026
Merged

Add remaning notification snippets for d.android.com#933
alabiaga merged 4 commits into
android:mainfrom
alabiaga:main

Conversation

@alabiaga
Copy link
Copy Markdown
Member

Change-Id: I5a9d083affc9ec7b9be5542a23933f694450a2b3
@alabiaga alabiaga requested a review from a team as a code owner May 29, 2026 20:12
@alabiaga alabiaga requested a review from simona-anomis May 29, 2026 20:12
@snippet-bot
Copy link
Copy Markdown

snippet-bot Bot commented May 29, 2026

Here is the summary of changes.

You are about to add 11 region tags.

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

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several Android notification features and styles to the Compose snippets, including progress style, call style (incoming, ongoing, screening), notification permission requests, notification channels, and chat bubbles. The review feedback highlights two critical issues: first, performing side effects directly within the notificationChannels composable function is an anti-pattern that should be managed with LaunchedEffect and user-initiated triggers; second, bubble notifications require publishing the sharing shortcut via ShortcutManagerCompat.pushDynamicShortcut to function correctly.

Change-Id: Id506798fc81383ec724f7a2be400ce04e3e025b2
val descriptionText = stringResource(R.string.channel_description)

// [START android_notification_channel_create]
androidx.compose.runtime.LaunchedEffect(Unit) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be done every time the composable launches again? This feels like something that should happen in once off in the Application Subclass of an app.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

right, this shouldn't be a composable at all. removing that annotation and just passing in context. Extracting the notification channel settings action in that method into a separate method. Thanks

mChannel.description = descriptionText
// Register the channel with the system. You can't change the importance
// or other notification behaviors after this.
val notificationManager =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a warning on this line about capturing context?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

none. Is that your expectation as a lint in Android Studio?

Change-Id: I8a55aeddd0f55fe1383bc2defe7204cc53160578
@alabiaga alabiaga requested a review from riggaroo June 2, 2026 15:22
@alabiaga alabiaga merged commit 9518dd1 into android:main Jun 2, 2026
9 checks passed
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