I have an Activity with a webview and a javascript interface on the java side. I would like to write a method in Java that can take a json parameter from a web view.
@JavascriptInterface
public String test(Object data) {
Log.d("TEST", "data = " + data);
}
on my javascript web browser I am calling:
MyAPI.test({ a: 1, b: 2 });
but the data variable is null.
How to pass JSON objects from webview javascript to native method?
thank
source
share