Javascript 在三星galaxy和HTC设备上不应调用
我正在做这样的事情:Javascript 在三星galaxy和HTC设备上不应调用,javascript,android,webview,xamarin,client,Javascript,Android,Webview,Xamarin,Client,我正在做这样的事情: LoadDataWithBaseURL("file:///android_asset/adhese/",fileContent, "text/html", "UTF-8", null); 我的Webviewclient类: public class DataWebViewClient : WebViewClient { public delegate void PageLoaded(); public event PageLoaded PageLoade
LoadDataWithBaseURL("file:///android_asset/adhese/",fileContent, "text/html", "UTF-8", null);
我的Webviewclient类:
public class DataWebViewClient : WebViewClient
{
public delegate void PageLoaded();
public event PageLoaded PageLoadedEvent;
public AndroidAdController controller;
public override bool ShouldOverrideUrlLoading (WebView view, string url)
{
if(url.Contains ("addsResponseLoaded"))
{
view.EvaluateJavascript ("window.giveMeMyResponse();", controller.JSResultObj);
//view.StopLoading ();
return false;
}
return true;
}
public override void OnPageStarted (WebView view, string url, Android.Graphics.Bitmap favicon)
{
if (!url.Contains ("addsResponseLoaded"))
base.OnPageStarted (view, url, favicon);
else
view.StopLoading ();
}
}
javascript函数:
function giveMeMyResponse(){
// send the ads object and the response object to the native app as json
return "[{\"myAds\":"+JSON.stringify(ads)+",\"myResponse\":"+JSON.stringify(myResponse)+"}]";
}
ads.response.then(function (response) {
// send a signal to the native app the adds have succesfully loaded by changing the url to addsResponseLoaded
myAds = ads;
myResponse = response;
this.document.location.href = "addsResponseLoaded";
});
在某些设备(如oneplus one)上,调用onpagestarted,然后调用shouldoverrideurlloading
但在htc或三星galaxy等其他设备上,永远不会调用shouldoverrideurlloading方法。我应该如何处理这一问题?所有这些设备的Android版本是什么?所有这些设备的Android版本可能重复?所有这些设备的Android版本可能重复?可能重复