Open Zyxer22 opened 1 year ago
Any updates on this?
I'm experiencing the exact same issue in my app right now. I'm using a custom Activity to show a splash screen on app start-up. When it disappears (by calling finish()
) the app disappears into the background without bringing back the TWA.
Is there any way of easily applying the fix you have @Zyxer22 to an Android package? I'm a web-developer mostly, and use patch-package
to apply patches to third party dependencies in the node ecosystem. How did you go about to apply your fix exactly?
If you look at the LauncherActivity that gets generated, it extends a similarly named one from a package. We decompiled that, grabbed the code, and created our own without the commented out bits I mentioned in the OP. It seemed to work, but we didn't move forward with that as a deployed solution. Maintaining our own 'branch' of this file wasn't something we wanted to do and we weren't sure what the other complications might be for removing the finish() call here. It seems pretty safe, but without more knowledge of how the package worked, it wasn't something we wanted to risk breaking larger parts of the app. If you run with the change, let us know what your experience looks like.
hi, i have this problem when navigating from a trusted domain to another, the app backgrounds and doesn't get fixed with the shared code by @Zyxer22
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.
Smartphone (please complete the following information):