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
- In the XML file that contains your WebView, replace
<WebView/>
with<com.splunk.mint.MintWebView
. - In your activity, add the following code:
- Extend MintWebView
- Use your own WebView client
This option is the easiest way to integrate WebView monitoring into your application.
MintWebView webView = (MintWebView) findViewById(R.id.webview);
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());
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'})
View memory trim notifications | Generate network events with an OkHTTP Interceptor |
This documentation applies to the following versions of Splunk MINT™ SDK for Android (Legacy): 5.2.x
Feedback submitted, thanks!