Run TWA without a browser installed

Viewed 268

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.

1 Answers

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

Related