I have a question which may be simple for you guys. I'm running a WebApp using Crosswalk(XWalkView), everything looks smooth. I found out how to launch a native function from inside the website into my Android App.
public class WebAppInterface {
@org.xwalk.core.JavascriptInterface
public void callFunction() {
onBuyGasButtonClicked(getCurrentFocus());
}
I need to know how to pass data along with it. I'm using in-app-billing. I got their code samples and I think everything is going fine, but I need to update my PHP MySQL server with the amount purchased. How can I pass the variable to my Android App? (egs. email)
Let's assuming passing a string from JavaScript to native code. Firstly, create a JavaScript interface as you did:
public class WebAppInterface {
@org.xwalk.core.JavascriptInterface
public void callFunction(String text) {
}
}
Then, add the interface to your XWalkView object:
mXWalkView.addJavascriptInterface(new WebAppInterface(), "testObject");
In your JavaScript:
function test(text) { testObject.callFunction(text); }