HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

Bug Reporting Callbacks for Android

Covered here are callbacks that you can use to have a block of code executed when a certain action is triggered for your Android apps.


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. You can also use this API to run some logic after the bug is reported and before it gets synced with the backend, in case you need to access some data to take specific actions.

Available Data: tags, consoleLog, filesAttachments, userAttributes, userData, appending data to consoleLog, attaching files, and adding tags.

Instabug.onReportSubmitHandler(new Report.OnReportCreatedListener() {
            public void onReportCreated(Report report) {
Instabug.onReportSubmitHandler{report -> }


By writing report. in the callback, the IDE autocomplete feature will show all of the mentioned operations that you can do or access on the report automatically.

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, feedback, question, and other.

Disabling Callbacks

To disable any previously created callbacks, you'll simply need to set the method to null as shown below:


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.