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

Chrome or samsung browser not find or not detected as custom tab compatible #468

Open cds-nl opened 6 months ago

cds-nl commented 6 months ago

Describe the bug Users are experiencing issues with our twa app. Device that are using chrome cannot open chrome. The issue: It seems that the package manager is unable to get the installed browser on the phone. Sometimes it returns that chrome browser is installed but it fails to detected it as a custom tab compatible browser. It is not a consistent bug. Most of the user are able to use the app for some times and suddenly the app is unable to find the browsers. Uninstalling the app does not fix the issue. A clone app (by changing the appID) will work even if the original one is not.

Expected behavior Browser & custom tab browser should be find

Did this ever used to work Use to have incompatibility with some phones, but the issue start to increase a lot mostly on samsung phones

Code Snippets Class: Token.class : PackageIdentityUtils.getFingerprintsForPackage(packageName, packageManager); Class from lib, does not find any app even if installed on the phone.

https://github.com/GoogleChrome/android-browser-helper/blob/7a2953b33daf921a6fe5e576d22e2af7664a2743/androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/TwaProviderPicker.java#L49 "pm.queryIntentActivities(queryBrowsersIntent, PackageManager.MATCH_DEFAULT_ONLY);" returns nothing

There is no way to reproduce it, it's completely random. A working device can suddenly stop working.

Smartphone (please complete the following information):