Cordova 6.2.3 has no WebChromeClient,how can i override the onJsPrompt()?

763 views Asked by At

when I update my project from cordova 3 to cordova 6,I find there is no WebChromeClient,but my project used this Class and override the onJsPrompt(). Now,how should i do base on Cordova 6 to override OnJsPrompt()

package com.qtby.gxwlc; import org.apache.cordova.CordovaChromeClient; import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaWebView; import com.jsdemo.ClientTool; import com.jsdemo.JsNativeFunc; import android.content.Intent; import android.webkit.JsPromptResult; import android.webkit.WebView; public class CustomerWebChromeClient extends CordovaChromeClient { public CustomerWebChromeClient(CordovaInterface ctx, CordovaWebView app){ super(ctx, app); } JsNativeFunc jsNativeFunc; public JsNativeFunc getJsNativeFunc(){ return jsNativeFunc; } public boolean isJsNativeFunc(int requestCode){ if(jsNativeFunc == null) return false; return jsNativeFunc.isJsNativeFunc(requestCode); } public void jsResult(int requestCode, int resultCode, Intent intent){ jsNativeFunc.jsResult(requestCode, resultCode, intent); } @Override public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, JsPromptResult result) { if(ClientTool.callNativeFunc(message)){ return super.onJsPrompt(view, origin, message, defaultValue, result); } return true; } return super.onJsPrompt(view, origin, message, defaultValue, result); } }

1

There are 1 answers

0
momoterraw On

You do this now.

import org.apache.cordova.engine.SystemWebChromeClient;

extends SystemWebChromeClient

https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java

Cheers