Skip to content

When launching a Chrome Custom Tab (through openBrowserAsync) on Android, the intent does not persists #5422

@aav7fl

Description

@aav7fl

🐛 Bug Report

Environment

  Expo CLI 3.0.10 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
      Yarn: 1.16.0 - ~/.yarn/bin/yarn
      npm: 6.10.1 - ~/.nvm/versions/node/v12.6.0/bin/npm
    IDEs:
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmGlobalPackages:
      expo-cli: 3.0.10

App target is both iOS and Android apps using Expo SDK 34.

Steps to Reproduce

On PR #4882 , there was a code change that made Custom Tabs opened in Android no longer show up in the device history.

https://github.com/expo/expo/pull/4882/files#diff-181a67a85ff6d2497b2ab4301faf3769R133-R134

That means when we call an external link in our app (on *Android devices), and the user briefly leaves the view, it closes on them.

Scenario 1:

  1. The user clicks the menu item which makes a openBrowserAsync call to a url.

  2. The user views their task list.

  3. The chrome custom tab dismisses itself without me tapping on anything.

app_switch

Scenario 2:

  1. The user clicks the menu item which makes a openBrowserAsync call to a url.

  2. The user navigates home on their device.

  3. The chrome custom tab dismisses itself in the background and the user cannot return to it.

app_home

Expected Behavior

I am expecting the custom chrome tab to persist if I leave the app and return. Just like how it behaves on our iOS app.

If the user leaves the app to check on something else, we shouldn't close their session in case they were in the middle of finishing something up.

Actual Behavior

The custom chrome tab is closed immediately when the app is put in the background/loses focus.

Reproducible Demo

https://snack.expo.io/@kylegfs/call-openbrowserasync

In the demo, tap purple the button.

On Android, if you leave the app (by going home, or viewing the other opened apps), the web browser goes away (bad!).

On iOS, if you leave the app, the web browser stays (good!).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions