Splunk MINT SDK for Android

Splunk MINT SDK for Android Developer Guide

Download manual as PDF

Download topic as PDF

Integrate WebView monitoring

WebView monitoring allows the MINT SDKs to access hybrid (non-native) web pages and gain visibility into their functions.

Integrate WebView monitoring

Use one of the following ways to integrate WebView monitoring into your application to view Web pages:

  • Use MintWebView
  • This option is the easiest way to integrate WebView monitoring into your application.

    1. In the XML file that contains your WebView, replace <WebView/> with <com.splunk.mint.MintWebView.
    2. In your activity, add the following code:
    3. MintWebView webView = (MintWebView) findViewById(R.id.webview);
      
  • Extend MintWebView
  • This option lets you use your own instance of WebView.

    webView = (MintWebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    MintJavascript mintJavascript = new MintJavascript(this, webView);
    webView.addJavascriptInterface(mintJavascript, "mintBridge");
    webView.setWebViewClient(new MintWebViewClient());
    
  • Use your own WebView client
  • To use your own WebViewClient, replace the last line of the previous example with the following code:

    webView.addJavascriptInterface(mintJavascript, "mintBridge");
    webView.setWebViewClient(new MintWebViewClient());
    
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            view.loadUrl(MintJavascript.loadMintJavascript());
        } 
    });
    


Hybrid API calls

You can use the following hybrid API calls.

Mint.initAndStartSession('apiKey')
Mint.startSession()
Mint.closeSession()
Mint.flush()
Mint.addExtraData('key', 'value')
Mint.clearExtraData()
Mint.leaveBreadcrumb('breadcrumb1')
Mint.logEvent('event name', {'key': 'value'})
Mint.logView('view name', {'key': 'value'} )
Mint.setLocation('myLatitude', 'myLongitude', 'myLocationTimestamp')
Mint.setUserIdentifier('username')
Mint.transactionCancel('transaction id', 'reason for cancel', {'key': 'value'})
Mint.transactionStart('transaction name', {'key': 'value'})
Mint.transactionStop('transaction id', {'key': 'value'})
PREVIOUS
View memory trim notifications
  NEXT
Java code example

This documentation applies to the following versions of Splunk MINT SDK for Android: 5.2.x


Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters