Android app doesn't use browser inside the app any more, launches site in full browser

Why did the Android app switch to launching sites in the full browser instead of using a browser view inside the app in 1.7.1?

I think this is the commit, since it removes use of ChromeCustomTab.

2 Likes

The app now also manages to crash on launch half the time. Is it possible to downgrade to an older version?

Sorry to hear the app is crashing on launch, I will look into that. Can you let me know what device you are using and what Android version you are on?

As you point out, the change to use the default browser instead of ChromeCustomTab was made in that commit from 2020, it should have already been there in the previous version of the app (1.6.0 I believe). We made that change because ChromeCustomTab was buggy and it required Chrome to be installed on the device for it to work. (Many users were complaining about the Chrome requirement of the app.)

Samsung Galaxy S9 running Android 10 security patch 1 May 2021 (the latest available). I think the crash happens when the app has been in the background for a while and not explicitly closed.

The commit dates from after the release of 1.6.0 (Feb 2020 if https://apkpure.com/discoursehub/com.discourse/versions is to be believed). The code removed already caught a failure to use ChromeCustomTab and launched the link, or would the app not launch at all without Chrome installed?

1 Like

Thanks, you are right, the removal of ChromeCustomTab was done in 1.6.2 which never made it to production (it was only in beta). So effectively this change is new in 1.7.0. See also Discourse Hub doesn't open forums in their PWAs - #12 by md-misko for more details on why we made the switch, in addition to working without Chrome, this change also allows launching the PWA from DiscourseHub.

I am about to push a beta version with a fix for the crash issue. Will post a link here when that is ready.

1 Like

OK so the solution is to install PWAs for each forum? Nope, that doesn’t work either, it still launches the tab in Firefox (I created the PWA with Chrome though). I have to say I never found the Chrome tab experience slow, certainly not compared to opening the full browser. Navigating back to the hub was quick too, just pull down to expose the X of the chrome tab.

Yes, you have a choice between using the PWA or a browser. If you don’t see a prompt, you can reset the defaults. In your Android settings, search for “opening links”, find the URL of your site, and then in its page click on “Clear defaults”. Once that is done, when going to DiscourseHub you’ll be prompted, it should look similar to this if you have a PWA installed:

Also, for the crash issue, please try version 1.7.2 in the beta release channel - https://play.google.com/store/apps/details?id=com.discourse

1 Like

I don’t have a Google account so can’t access the beta channel (I use Aurora Store which doesn’t seem to support it).

I cleared defaults from Firefox and get the prompt now, but it only shows browsers, not the PWA.

And the Chrome PWA doesn’t send me notifications either. Never mind, a disable/enable got it to send one. Some further investigating and reading of Add to homescreen banner on Android - #62 by Falco indicates the WebAPK bit isn’t working for me, since that’s what binds the intents for the site’s URLs, and I don’t see a new icon in the applications drawer or app settings.

1 Like

I just tested adding your site as a webapk on my phone and it did work, but took a while. Testing with other sites it appears that the WebAPK minting server from Google is a bit slow at the moment, but waiting a couple minutes did work for me.

1 Like

Version 1.7.2 of the app is now in production in the Google Play Store (not sure how quickly the Aurora Store will see the update, though).

Aurora store uses the play store, just without having a Google account on your phone (it uses an anonymous one to get a token).

Which is maybe why WebAPK doesn’t work for me, if they need a google account to be created via Google’s servers.

Or it’s because Chrome calls Google play to install the WebAPK chromium/WebApkInstaller.java at master · chromium/chromium · GitHub which requires a google account.

So in order to address user complaints about Chrome being installed, you removed ChromeCustomTab and instead changed to a workflow around WebAPKs, which require Chrome (or Samsung browser) and a Google account to work as intended. So it’s less accessible. Also there is a way to use the default browser’s custom tab implementation since about half of my apps get a Powered by Firefox version instead of the Chrome version.

1 Like

Did some digging on this, and came across the following:

https://community.tt-rss.org/t/dont-hardcode-chrome-when-opening-custom-tabs/319
https://git.tt-rss.org/fox/tt-rss-android/src/branch/master/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java#L97

and here’s an implementation that correctly uses Firefox custom tabs on my device:

So could you re-add it with this extra detection, which would remove the Chrome dependency properly and make the app useful again?

The problem is that I would like to give users a choice. Going back to CustomTabs (and fixing the Chrome-only thing) doesn’t give users a choice, it forces the custom tab at all times. So a user that wants to open the site in the browser or in a PWA is out of luck. We can’t go back to that.

But I am going to see if I can find a way to add the in-app custom tab as an option alongside browsers and PWAs. It’s a little tricky, not sure it’s 100% doable but I will try.

It might take me a little bit of time to get to this task, but will let you know when I have a testable beta.

3 Likes

I found some time over the weekend and pushed just now an updated version of the Android app (1.7.3) that allows users to switch back to using custom tabs. There is a new button at the bottom right corner of the screen that displays a settings screen where you can make the switch. Let me know how it goes once you are able to update.

3 Likes

I can’t see the updated app in Google Play, has it been held up for approval by Google or something?

1 Like

It should be there today, sorry about that (the Play Store UI defaults to a staggered rollout).

Working as expected, I get a chrome tab with the setting enabled, and it launched the full browser with it disabled. Thanks for updating it so quickly :slightly_smiling_face:

1 Like

This version fixed the crashes, but the new 1.7.3 version is crashing again constantly for me.

I’m on beta channel, are those versions synced between beta and production on Play Store?

[edit]: when setting “open sites in in-app browser”, PWA enabled sites still open as separate apps (which is expected), but crashes are less frequent (almost never), while unsetting this crashes the app every time.