android-js/androidjs

TWA Integration with androidjs

rmr-code opened this issue · 1 comments

CHALLENGE
One challenge of using a PWA on Android is to associate a file type and get it to open using the Javascript code. I can see how androidjs could perhaps be tweaked to achieve this

PROPOSED SOLUTION
There are four parts to the solution.
(a) a method to associate a file-type or mime-type with an App. This can only be done via an Intent Filter.
(b) load the PWA either using webview (with its limitations) or TWA preferably.
(c) if user has tapped on a file, then, read the contents of the file. This again can be done only via java or a nodejs code (using fs)
(d) communicate the contents (blob) to the javascript code running inside the app. IPC would help.

This is pretty much how Electron works.

ALTERNATIVES
All solutions are being looked at using TWA for obvious reasons. Current SO browsing indicates that only url parameters can be passed to the web app. In our use-case, we need a blob. And message sending (being considered) has so far been disallowed in TWA.

From your documentation I understand you are using ReactNative as a framework and a React-Native-TWA is already available (npm react-native-trusted-web-activity). So instead of a webview if this can be used and we use the back and front module of your library, it would solve the above problem IMO.

Thanks

@rrrepos Hey, I really like the concept, ASAP I'll get time, will work on this.
or you can also contribute to this project, I'll be there to guide you : )