Callbacks
Covered here are callbacks that you can use to have a block of code executed when a certain action is triggered.
Avoiding Memory Leaks
These APIs hold the callbacks in a strong reference, so we strongly suggest to avoid registering callbacks without unregistering them when needed, as it may cause a memory leak.
Before Invoking Instabug
This block is executed on the UI thread. You can use it to perform any UI changes before the SDK's UI is shown.
BugReporting.setOnInvokeCallback(new OnInvokeCallback() {
@Override
public void onInvoke() {
//do something
}
};
Before Sending a Report
This block is executed in the background before sending each report. You can use it to attach logs and extra data to reports.
Instabug.onReportSubmitHandler(new Report.OnReportCreatedListener() {
@Override
public void onReportCreated(Report report) {
}
};
After Dismissing Instabug
This block is executed on the UI thread. You can use it to perform any UI changes after the SDK's UI has been dismissed.
BugReporting.setOnDismissCallback(new OnSdkDismissCallback() {
@Override
public void call(DismissType issueState, ReportType reportType) {
}
});
Updated about 5 years ago
Check out our attachments section for details on how to attach your own file. You can even attach a file in one of the callbacks above! You can also set custom data, such as a user attribute, at any time, including inside callbacks. Logging user events in callbacks is also possible.