HomeDocumentationAPI Reference
Getting StartedAPI ReferenceHelp CenterVideo Tours


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() {
            public void onInvoke() {
               //do something
BugReporting.setOnInvokeCallback {
                     //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() {
            public void onReportCreated(Report report) {
Instabug.onReportSubmitHandler{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() {
            public void call(DismissType issueState, ReportType reportType) {
BugReporting.setOnDismissCallback { issueState, reportType -> }

You can find the following parameters within the setOnDismissCallback callback.


Returns how the SDK was dismissed. It can be set to one of the three following possibilities:

  • SUBMIT: Indicates that the issue was submitted and will be uploaded
  • CANCEL: Indicates that the user closed the Instabug view without report submission
  • ADD_ATTACHMENT: Indicates that the issue is in the process of being reported (for example, user is taking another screenshot)


The type of report that was sent. If the SDK was dismissed without selecting a report type, it will be set to BUG, so you might need to check issueState before ReportType. The possible different types are BUG and FEEDBACK.

What’s Next

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.