Best way to improve Android web browser download performance for SPA

Question

I wonder what the best way to do Android web browsing is best for downloading a single page application.

Position

I already have a web application with AngularJS.

I am currently creating an Android app and am using webview for the main view of this.

This Android app sends an HTTP request every time users click on a menu from their side.

Unfortunately, loading web pages is very slow since it always gets the entire resource from my web application, although one of the great advantages of a single-page application is the function of routing URLs without updating the entire page, as I understand it correctly. Below is my code for downloading a webview. Nothing has changed, but I installed setCacheMode(WebSettings.LOAD_DEFAULT).

webviewFragment.java
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    String url = getArguments().getString("URL");
    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setAllowFileAccess(true);
    settings.setCacheMode(WebSettings.LOAD_DEFAULT);
    webView.loadUrl(url);
    webView.setWebViewClient(new WebViewClient() {
        // handle url-scheme
    }
        webView.setWebChromeClient(new WebChromeClient() {
        // handle reaction for UI Component
    }
}
+4
source share

Source: https://habr.com/ru/post/1659973/


All Articles