android-jsinterface

Using WebView for multi-page login to website and fetch data

跟風遠走 提交于 2019-12-23 19:45:56
问题 I'm building an Android app as a mobile client for a website that does not (and will not) have it's own UI for mobile browsers. My chosen architecture uses a hidden WebView which I initialise (loadURL) with the login page, and then I load JavaScript to populate the login pages (there are two) with the user's name, password and other credentials. Once logged in, I'll navigate to a new URL and then use a JavaScriptInterface to extract sections of HTML from the pages for parsing and use in my

Sometimes throws Uncaught Error: Error calling method on NPObject on Android

夙愿已清 提交于 2019-11-29 23:03:52
I am having problems with the Webview in Android and it's JavascriptInterfaces. I am passing a string to the JavascriptInterface. When debugging it, I receive the correct string within my Android application. The problem: Sometimes I get an Uncaught Error: Error calling method on NPObject. Does anybody know why? The Interface in Java: public class JSInterfaceGame extends JSInterface { @JavascriptInterface public void setShareText(String share){ shareText = share; if(mJSInterfaceListener != null) mJSInterfaceListener.onParametersChanged(SHARE_TEXT); } The initialization in the onCreateView

Sometimes throws Uncaught Error: Error calling method on NPObject on Android

旧城冷巷雨未停 提交于 2019-11-28 20:12:10
问题 I am having problems with the Webview in Android and it's JavascriptInterfaces. I am passing a string to the JavascriptInterface. When debugging it, I receive the correct string within my Android application. The problem: Sometimes I get an Uncaught Error: Error calling method on NPObject. Does anybody know why? The Interface in Java: public class JSInterfaceGame extends JSInterface { @JavascriptInterface public void setShareText(String share){ shareText = share; if(mJSInterfaceListener !=