I am running an angular app in android webview but for some reason, the webview does not load the angular app. I have no way of testing as it works perfectly in the browser but fails. The android version I am running is 4.4.2 but it works fine on my emulator running android api v29.I get the following error in the android studio console when running the app:
[INFO:CONSOLE(1)] "Uncaught SyntaxError: Use of const in strict mode.", source:
https://app-3f68a52a277a.herokuapp.com/polyfills.ea18fce2c9ce8d9f5540.js (1)
I/chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Use of future reserved word in strict mode", source: https://app-3f68a52a277a.herokuapp.com/main.3fe416c69fb5797ef75e.js (1)
I/SnapScrollController: setSnapScrollingMode case-default no-op
the app works perfectly file in locally and on the server but webview is loading an empty page. When the url is changed to google, it works perfectly fine.
anyone know how I can debug the exact issue or fix this?
My webview is set as:
myWebView = (WebView) findViewById(R.id.webview);
WebSettings myWebViewSettings = myWebView.getSettings();
myWebViewSettings.setAllowFileAccess(true);
myWebViewSettings.setAllowContentAccess(true);
myWebViewSettings.setAppCacheEnabled(true);
myWebViewSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
myWebViewSettings.setJavaScriptEnabled(true);
myWebViewSettings.setDomStorageEnabled(true);
myWebViewSettings.setLoadWithOverviewMode(true);
myWebViewSettings.setUseWideViewPort(true);
myWebView.setInitialScale(1);
myWebViewSettings.setUseWideViewPort(true);
myWebViewSettings.setBuiltInZoomControls(true);
myWebViewSettings.setPluginState(WebSettings.PluginState.ON);
myWebView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView view, final String url) {
}
@Override
public void onPageStarted(WebView view, String url,
Bitmap favicon) {
}
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
if (handler != null){
handler.proceed();
} else {
super.onReceivedSslError(view, null, error);
} }
});
myWebViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
myWebView.getSettings().setUserAgentString(USER_AGENT);
myWebView.setWebChromeClient(new WebChromeClient());
myWebView.setKeepScreenOn(true);
myWebView.loadUrl("https://app.herokuapp.com");