4

I recently replaced Cordova app in google play to work with TWA.

After that, I start to get many complaints that the app stopped working on many phones.

After speaking with many clients I discovered the problem.

In Israel, many religious people don't want to use the internet as much as they can.

So a part of them has Smartphones that only have a few apps on them like WAZE, Mail, etc.

One app that they don't have on their phones is a browser.

So when I was changing my app to work with TWA, I was assuming that every phone will have a browser. but this assumption was clearly not true.

The only workaround for these people that I can think of is to have some browser that you can't browse with, but the TWA engine will be in the phone. So when the client will try to open my app, even that he doesn't have a proper browser he will be able to open the app in the TWA engine.

If anyone has an idea how can I do that, or have any other idea, I will be more than happy to hear about it.

  • Well, I know one small, open source browser that you might want to take a look. [Via Browser](https://github.com/tuyafeng/Via) – Darkman Jun 20 '21 at 12:07
  • 1
    this browser has a browsing option. These people don't want this option. I need a browser without the browsing option. – אברימי פרידמן Jun 20 '21 at 12:12
  • 1
    A TWA is a web app which will need a browser. If you can't rely on a device browser you'll have to ship your own like Cordova or Capacitor. – abraham Jun 21 '21 at 11:01
  • You are right. what I'm looking for is how to do so. If I can send my clients to download an app and then my app will run on their device it will be good. the question is what capacitor? I don't want to build it myself because then I have to maintain it. – אברימי פרידמן Jun 21 '21 at 11:13

1 Answers1

0

The android-browser-helper library provides a WebViewFallbackActivity that can be used when a browser that supports Trusted Web Activity is not available on the device.

You can enable it by adding the following meta-tag to the activity tag for the LauncherActivity in AndroidManifest.xml:

<meta-data 
    android:name="android.support.customtabs.trusted.FALLBACK_STRATEGY"
    android:value="webview" />

and declare the WebViewFallbackActivity

<activity
 android:name="com.google.androidbrowserhelper.trusted.WebViewFallbackActivity"
 android:configChanges="orientation|screenSize" />

You can check how to configure it in this demo

andreban
  • 4,621
  • 1
  • 20
  • 49