GoogleChrome / android-browser-helper

The Android Browser Helper library helps developers use Custom Tabs and Trusted Web Activities on top of the AndroidX browser support library.
Apache License 2.0
694 stars 288 forks source link

Move connecting/disconnecting from service to onCreate/Destroy #471

Closed andreban closed 5 months ago

andreban commented 5 months ago

The problem I many cases, applications want to stay connected to the Custom Tabs service after the Custom Tabs is launched. They might want to listen for Custom Tabs callback events or enable a minimized tab to be replaced with a new one when relaunching. The existing code disconnects from the Custom Tabs service when the Activity is stopped, preventing either of those to happen.

The solution Move binding and unbinding from the Custom Tabs Service to onCreate() / onDestroy(), so the application will stay connected to the service after it is backgrounded, allowing it to continue receiving callbacks and replace a minimized Custom Tab.

andreban commented 5 months ago

Code changes look good, but could you add a bit more to the description - you say what goes wrong, but not how this change fixes it.

Updated the PR description. PTAL.

PEConn commented 5 months ago

Amazing, LGTM, thanks.