Crash Reporting Callbacks
Covered here is how to set up the callbacks that fire before every crash report is sent so that a specific block of code is executed in your Android app.
Before Sending a Report
This handler runs in the background before each bug report and crash report is sent, including non-fatal errors, ANRs and fatal hangs. It doesn't run for NDK crashes, surveys, feature requests or chat replies. You can use it to add tags, user attributes, user data and file attachments to the report. Return the event you received to send the report. We recommend registering it when you build the SDK, so it also covers a crash from the previous app launch; see Bug Reporting Callbacks.
Luciq.setOnBeforeSendHandler { event ->
event.appendTags(listOf("checkout"))
event.appendUserAttributes(mapOf("plan" to "premium"))
event.setUserData("Cart: 3 items")
// fileUri: a Uri your app can read
event.addFileAttachment(fileUri, "cart.json")
event
}Luciq.setOnBeforeSendHandler(event -> {
event.appendTags(Arrays.asList("checkout"));
event.appendUserAttributes(Collections.singletonMap("plan", "premium"));
event.setUserData("Cart: 3 items");
// fileUri: a Uri your app can read
event.addFileAttachment(fileUri, "cart.json");
return event;
});Exporting Crash Metadata
You can use the below API to capture metadata about the crash including:
Error Type: The error type including ANR (Foreground ANR), BG_ANR (Background ANR), Non-fatal errors and NDK crashes.
Error Code: The specific error code associated with the crash.
User Attributes: User attributes associated with the session.
Error Description: The error message associated with the crash
Last updated