GoogleChrome / GoogleChrome/android-browser-helper

When a separate activity is launched and finished, the app backgrounds and doesn't return to the twa activity

Open
#428 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
832
Forks
370
Avg merge
1d 3h
Merged PRs (30d)
6

Description

**Describe the bug**
When a separate activity is launched and finished, the app backgrounds and doesn't return to the twa activity.

**To Reproduce**
1) In the manifest file, create an intent to launch an activity
2) In the related Activity class, override the onCreate() with a call to finish()
3) Cause that activity to launch
4) The app is no longer in the foreground

**Expected behavior**
The TWA activity reopens.

**Code Snippets**
What we've done in the meantime is created our own version of the LauncherActivity that launches the TWA Activity during the onRestart() lifecycle.

```
protected void onRestart() {
super.onRestart();
this.launchTwa();
// if (this.mBrowserWasLaunched) {
// this.finish();
// }
}
```

**Smartphone (please complete the following information):**
- Device: Several, including Pixel 6
- OS: Several, including 12 and 13
- Browsers Installed: Chrome
- android-browser-helper library version: 2.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.