Skip to content

Handle ActivityNotFoundException in launchCustomChromeTab#2118

Open
saadkhalidkhan wants to merge 1 commit into
android:mainfrom
saadkhalidkhan:fix/handle-activity-not-found-in-chrome-tab
Open

Handle ActivityNotFoundException in launchCustomChromeTab#2118
saadkhalidkhan wants to merge 1 commit into
android:mainfrom
saadkhalidkhan:fix/handle-activity-not-found-in-chrome-tab

Conversation

@saadkhalidkhan
Copy link
Copy Markdown

Summary

  • Catch ActivityNotFoundException in launchCustomChromeTab to prevent crashes on devices without a browser installed
  • Show a Snackbar (per Material guidelines) instead of crashing when no browser is available
  • Move LocalSnackbarHostState from feature/bookmarks/impl to core/designsystem so all modules can access it (resolves existing // TODO: Why is this here?)

Fixes #1068

Context

A previous fix (#1090) was closed because it used Toast instead of Snackbar. This PR uses the existing SnackbarHostState infrastructure to show a Material-compliant error message.

Test plan

  • ./gradlew assembleDemoDebug passes
  • ./gradlew spotlessApply passes
  • Install on a device/emulator without a browser, tap a news resource card, and verify the Snackbar appears instead of crashing

@saadkhalidkhan saadkhalidkhan requested a review from dturner as a code owner May 25, 2026 07:38
Copy link
Copy Markdown

@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 centralizes the LocalSnackbarHostState into the core design system and implements error handling for opening links via Chrome Custom Tabs. If no browser is available on the device, a snackbar message is now displayed to the user. The review feedback suggests providing a default value for the CompositionLocal to prevent Composable Previews from crashing and requests the removal of a local utility script (do-commit.ps1) that was inadvertently included.

Comment thread do-commit.ps1 Outdated
Catch ActivityNotFoundException when launching a Chrome Custom Tab on
devices without a browser installed. Show a Snackbar instead of crashing.

Also moves LocalSnackbarHostState from feature/bookmarks/impl to
core/designsystem so all modules can access it (resolves existing TODO).

Fixes android#1068
@saadkhalidkhan saadkhalidkhan force-pushed the fix/handle-activity-not-found-in-chrome-tab branch from 329f0fa to 1847fee Compare May 25, 2026 07:55
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.

[Bug]: launchCustomChromeTab should handle ActivityNotFoundException

1 participant