قالب وردپرس درنا توس
Home / IOS Development / javascript – Blocked JS device orientation deviation on Android WebView

javascript – Blocked JS device orientation deviation on Android WebView



May it be, it is not possible to stop just triggering JS events through Android, if you want it, it will disable the entire JS.

  // disabled
wView.getSettings () setJavaScriptEnabled (false) .;
// enabled
wView.getSettings () setJavaScriptEnabled (true) .;

As, you said that on some devices you do not get sensor data, for this you need to check the web view declaration code.
Sample code is here:

  wView = new WebView (this);
. WView.getSettings () setLoadsImagesAutomatically (true);
wView.getSettings () setJavaScriptEnabled (true) .;
wView.setScrollBarStyle (View.SCROLLBARS_INSIDE_OVERLAY);

wView.setWebViewClient (new WebViewClient () {
@SuppressWarnings ("Settlement")
@Overstyring
public void onReceivedError (WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText (MainActivity.this, description, Toast.LENGTH_SHORT) .show ();
}

@TargetApi (android.os.Build.VERSION_CODES.M)
@Overstyring
public void onReceivedError (WebView view, WebResourceRequest req, WebResourceError)
// Divert to outdated method so you can use it in all SDK versions
onReceivedError (view, rerr.getErrorCode (), rerr.getDescription (). toString (), req.getUrl (). toString ());
}
});

wView.loadUrl (HOST_URL);

I Manifesto

  
 

Source link