I have business logic written in JavaScript, this code is used in conjunction with other applications other than android.
What is the best way to use the functions in this JavaScript snippet from a service on Android.
AFAIK, are there 2 options?
- V8, built into the standard WebView and ultrafast, without additional apk overlays.
- Rhino, what is difficult to do on Android?
Focusing on V8 / Webview, when I try to access WebView, with any function, I get:
All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
A warning is noted, it does not even work. When I install webviewclient, I get nothing after loading the url.
My question consists of 3 parts;
1) Has anyone been successful with running javascript in webview without a user interface thread?
2) How to get results from functions inside javascript, does the webview "addJavascriptInterface" interface support loading a parameter and sending it back to java?
3) If one of the above is impossible. I think Iβll go for Rhino, any advice will be appreciated, I only saw a few blogs complaining about problems with getting it on Android and I wonder if there is a βgo toβ version for a supported android.
javascript android android-service android-webview rhino
Pork 'n' bunny
source share