How to use BugSense correctly with custom data?

822 Views Asked by At

I try to implement BugSense in my Android Application, but I'm not able to see the custom data I submitted. I really can't find out where the problem is, because I get an error report but without custom data. I implemented com.bugsense.trace.ExceptionCallback to receive all unhandled exceptions in the "lastBreath" method.

Here is my example code:

@Override
public void lastBreath(Exception arg0) {
    Log.w(TAG, "executing lastBreath");
    // adding current details to crash data
    HashMap<String, String> errorDetails = new HashMap<String, String>();
    errorDetails.put("testKey", "testValue");
    errorDetails.put("testKey2", "testValue2");
    BugSenseHandler.sendExceptionMap(errorDetails, arg0);
    Log.w(TAG, "lastBreath executed");
}

This is generating an error report but I don't know where to find the custom values of "testKey" and "testKey2". I used the example code of the official site, so where is the problem? Thanks for your help.

1

There are 1 best solutions below

0
Oliver Drummond On

I'm doing this data collection a little bit different from you. Here is how I do it:

//Call the initAndStartSession right before the setContentView of your activity (onCreate method)
BugSenseHandler.initAndStartSession(UserLogin.this, APIKEY);
//Add the values that you need to monitor
BugSenseHandler.addCrashExtraData("testKey", testKey);
BugSenseHandler.addCrashExtraData("testKey2", testKey2);

Once the error occurs, go to your BugSense errors page. (The link should look something like: https://www.bugsense.com/dashboard/project/YOUR_PROJECT_ID/errors/ ) and click on the exception link (as seen on the image bellow).

Errors Page

Now, once on the error page, click on the "Error Instances"

Error Instances

Now, if you click on the wrench Icon, you will see your "testKey" and "testKey2" available to be shown. Last Step

Hope it works!