WebView IntegrationΒΆ

When a WebView is used in a native Android app, metrics can be collected by using the additional integration steps outlined in this document.

When Neumob is initialized with Neumob.initialize all traffic from WebView is accelerated, but metrics are not captured for any of the WebView URL requests, due to how WebView works.

To capture the page loading metrics for WebView, initialize the WebView using Neumob.initializeWebView(WebView webView, Activity activity). This method uses WebView.setWebViewClient to set an instance of WebViewClient and track the metrics.

If you need to use WebViewClient in your activity use Neumob.initializeWebView(WebView webView, Activity activity, WebViewClient client) to pass an instance of WebViewClient

Example:

Without WebViewClient object.

public class WebViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      ...
      // Initialize WebView with Neumob
      Neumob.initializeWebView(this.wvMain, this);
      ...
    }
}

With WebViewClient object.

public class WebViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      ...
      // Initialize WebView with Neumob
      Neumob.initializeWebView(this.wvMain, this, new WebViewClient() {
        public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
        }
      });
      ...
    }
}

Note

  1. WebView metrics are at the page level, which includes the loading time for all embedded resources such as javascript, css and images.
  2. WebView metrics doesn’t include any requests made using XMLHttpRequests objects.
  3. Neumob does not currently support networking metrics HTTPS requests made in a WebView.

Warning

This is applicable only for WebView in native app not for Cordova applications.