Splunk MINT SDK for Android (Legacy)

Splunk MINT SDK for Android Developer Guide

Acrobat logo Download manual as PDF


Splunk MINT is no longer available for purchase as of January 29, 2021. Customers who have already been paying to ingest and process MINT data in Splunk Enterprise will continue to receive support until December 31, 2021, which is End of Life for all MINT products: App, Web Service (Management Console), SDK and Add-On.
Acrobat logo Download topic as PDF

Add custom data to crash reports

Add custom data to crash reports

Although Splunk MINT collects plenty of data associated with each crash of your app, you can collect additional custom data. To add custom data to your crash reports, use the extra data map or add data as key-value pairs. The maximum length of keys is 128 characters. The maximum length of values is 256 characters. The maximum number of extra data key-value pairs is 32.

  • To add key-value pairs to the extra data map, use the addExtraData(key, value) method as follows :
  • Mint.addExtraData("level", "second level");
    Mint.addExtraData("difficulty", "impossibruuu");
    
  • Get the extra data map by using the getExtraData() method.
  • HashMap<String, Object> extras = new HashMap<String, Object>();
    extras = Mint.getExtraData();
    
  • To remove a specific value from the extra data, use the removeExtraData(key) method as follows:
  • Mint.removeExtraData("difficulty");
    
  • To clear the extra data completely, use the clearExtraData() method as follows:
  • Mint.clearExtraData();
    

View custom data

To view the custom data in a crash report in Splunk MINT Management Console:

  1. Go to the Errors dashboard and select an error.
  2. In the error details section, click the Error Instances tab.
  3. In the Show All column, click the arrow.


To view the custom data for all of your mobile apps, run a search in the Splunk MINT App. For example, the following search lists errors with the values of the custom "level" field:

sourcetype=mint:error | table message, extraData.level

For more about running searches in MINT, see Searches in the Splunk MINT App User Guide.


Example code

public MyActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: Update with your API key
        Mint.initAndStartSession(this.getApplication(), "YOUR_API_KEY");
        Mint.addExtraData("loginfrom", "Facebook");
        Mint.addExtraData("gender", "male");
    }
    // Called when the user presses the Logout button
    public void userLogout() {
        Mint.removeExtraData("loginfrom");
        Mint.removeExtraData("gender");
        // OR:
        Mint.clearExtraData();
    }
}
Last modified on 28 January, 2019
PREVIOUS
Report ANRs
  NEXT
Add breadcrumbs to crash reports

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


Was this documentation topic helpful?


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