onCreateWindowRequested is not working for my code... I don't know why.... I searched google, and I trying to my best,.. but I couldn't solve this problem... This code is final code to written me.
What's the problem this code ? please, give me the solve. thank you.
Webview Setting CODE
NewWalkUIClient walkUIClient = new NewWalkUIClient(mWeb);
NewXwalkResource walkResource = new NewXwalkResource(mWeb);
mWeb.setUIClient(walkUIClient);
mWeb.setResourceClient(walkResource);
mWeb.getSettings().setLoadWithOverviewMode(true);
mWeb.getSettings().setUseWideViewPort(true);
mWeb.getSettings().setJavaScriptEnabled(true);
mWeb.getSettings().setDomStorageEnabled(true);
mWeb.getSettings().setSupportZoom(false);
mWeb.getSettings().setBuiltInZoomControls(false);
mWeb.clearCache(true);
mWeb.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
mWeb.getSettings().setSaveFormData(false);
mWeb.clearFormData();
mWeb.getSettings().setSupportMultipleWindows(true);
mWeb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
NewWalkUIClient
public class NewWalkUIClient extends XWalkUIClient {
public NewWalkUIClient(XWalkView view) {
super(view);
}
@Override
public void onPageLoadStopped(XWalkView view, String url, LoadStatus status) {
super.onPageLoadStopped(view, url, status);
if(mWeb != null) {
mWeb.getNavigationHistory().clear();
mWeb.clearCache(true);
}
}
@Override
public void onJavascriptCloseWindow(XWalkView view) {
super.onJavascriptCloseWindow(view);
}
@Override
public boolean onCreateWindowRequested(XWalkView view, InitiateBy initiator, ValueCallback<XWalkView> callback) {
Log.d("TAG", "onCreateWindowRequested: ");
XWalkView newView = new XWalkView(thisActivity);
newView.setUIClient(new NewWalkUIClient(newView));
// other initialization like your initial XWalkView object
callback.onReceiveValue(newView);
return true;
}
}
NewXWalkResource
public class NewXwalkResource extends XWalkResourceClient {
public NewXwalkResource(XWalkView view) {
super(view);
}
@Override
public void onLoadStarted(XWalkView view, String url) {
super.onLoadStarted(view, url);
}
@Override
public void onLoadFinished(XWalkView view, String url) {
super.onLoadFinished(view, url);
}
@Override
public boolean shouldOverrideUrlLoading(XWalkView view, String url) {
if (url.startsWith("tel:")) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.putExtra(Browser.EXTRA_APPLICATION_ID, appContext.getPackageName());
Intent i = new Intent(Intent.ACTION_DIAL , Uri.parse(url));
startActivity(i);
} else {
// MARK : Load Web URL
mWeb.load(url, null);
}
return true;
}
}