Vanadium icon indicating copy to clipboard operation
Vanadium copied to clipboard

Web Share API not working with installed PWAs

Open raucao opened this issue 2 years ago • 8 comments

On my previous Android phones, I was using a couple of my own PWAs installed via Chromium in order to e.g. store bookmarks on my own storage server. Installed PWAs with a defined share target in the Web App Manifest are usually available in the native Android share dialog when trying to share a URL from any other installed app.

Unfortunately, this does not seem to be the case with GrapheneOS when installing PWAs to the home screen. The apps are missing from the share dialogs entirely. I'm wondering if this is intentional or a bug, or a feature that isn't available in Vanadium for another reason.

raucao avatar Sep 18 '23 17:09 raucao

Were the apps possibly installed as WebAPKs on your old phones? WebAPKs are unsupported in Vanadium because they are generated on Google's servers. Vanadium uses the old method, which simply creates a shortcut (widget) to the website on your home screen - it is not a distinct app. Clicking on the shortcut/widget just opens it in a special view in Vanadium. You can verify this because if you go to the multitasking view, press the app icon at the top, then press "about this app", it will show Vanadium.

From what I can tell, the web share target API was added after WebAPKs were introduced (Chrome 71 came out in December 2018, the article linked above was published in 2017), so it is very possible Google didn't bother adding a web share API implementation for the old way of installing PWAs since it was deprecated by that point.

Vanadium most likely won't add support for WebAPKs, not unless they make a way to create WebAPKs locally or in some other privacy-friendly way (and either way the developers are probably focused on other things). Some other Chromium-based browser might (but it's not likely since from what I can tell the API to generate these APKs is protected by a Chrome/Google-only API key), or maybe you could try Firefox for Android? I don't know how PWAs are handled there but maybe it's better? But be careful of using Firefox-based browsers, they have lower privacy/security than Vanadium (no site isolation on Android).

andre4ik3 avatar Oct 01 '23 16:10 andre4ik3

Thanks for the detailed response! Yes, in order to register intents (from Web App Manifest share target properties), you need an actual app installed, so the apps I'm using this with have been installed from Chrome via WebAPKs.

I'm wondering if the test build instructions here could be used to do local builds of the packages directly on the phone, or if that's only for developers on desktop systems: https://chromium.googlesource.com/chromium/src/+/master/chrome/android/webapk/README.md

It is possible to build a test WebAPK and bypass the generation on the WebAPK server.

On Android, build //chrome/android/webapk/shell_apk:webapk On ChromeOS, build //chrome/android/webapk/shell_apk:webapk_chromeos

Both can be customized via shell_apk/manifest/bound_manifest_config.json

raucao avatar Oct 31 '23 11:10 raucao

At the very least the phone would have to have Chromium build tools installed (gn, ninja, cpp compilers). This would bloat the software and introduce new attack surface probably (e.g. build flag sanitization and stuff like that).

The only way I see this working is if there is a single APK file that is already included in Vanadium, like a template. The APK is pre-compiled, so when the browser wants to install a PWA, it simply unzips the template, changes out the intents and manifest, zips it back up again, signs it, and installs it.

Please take all of the above with a grain of salt, I don't know much about Chromium/WebAPK internals. But that's how I assume it could work.

andre4ik3 avatar Nov 01 '23 07:11 andre4ik3

I don't know if this is related or if I should create an issue for this but I have been having issues with PWAs installed with Firefox for Android (Fenix/Fennec/Mull). When attempting to interact with an input, the keyboard doesn't behaviour as it should(flashes out of screen). This only happens when the app is "Installed". Adding to the home screen the behaviour is normal.

dev0T avatar Nov 20 '23 23:11 dev0T

@dev0T That sounds like a browser issue.

thestinger avatar Nov 21 '23 02:11 thestinger

@dev0T That sounds like a browser issue.

Understood! Thanks

dev0T avatar Nov 21 '23 17:11 dev0T

Let's see if OWA work regarding this is fruitful: https://open-web-advocacy.org/blog/google-must-share-the-ability-to-install-web-apps-in-android/

pachulo avatar Oct 14 '24 10:10 pachulo

@pachulo I don't think anything has changed?

francoism90 avatar Mar 08 '25 23:03 francoism90