GoogleChrome / android-browser-helper

The Android Browser Helper library helps developers use Custom Tabs and Trusted Web Activities on top of the AndroidX browser support library.
Apache License 2.0
701 stars 291 forks source link

How to call TWA native method from Java Script running in url #230

Closed mohit1993 closed 4 years ago

mohit1993 commented 4 years ago

I am unable to find any method like webview.addJavascriptInterface in TWA , please let me know if this is possible.

PEConn commented 4 years ago

Hey, currently this is not possible.

There are discussions about adding postMessage support to TWAs - this would allow the Android app and the website to communicate with each other, and would effectively do what you're trying to do. At the moment though, we're gathering the user cases we have for this.

We already have a discussion going on Issue #55 , so do you mind adding your use case to that thread? I'm going to close this issue in favour of that one.