HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

SDK 8.0 Migration Guide

This page covers the migration steps from previous versions of the SDK to Instabug Version 8.0+ for Android apps.

Version 8.0 of the Instabug Android SDK contains various changes to our APIs. This document contains detailed instructions on how to migrate from previous versions of the SDK to Instabug Version 8.0 and above.

To make our APIs more intuitive, more organized and easier to use, we renamed some of them and restructured them into different classes.

Summary of Changes

In addition to the Instabug class, Instabug now has the following additional classes:

  • BugReporting
  • CrashReporting
  • Surveys
  • FeatureRequests

Each class contains methods and properties of a single product or feature.

See all changes here:

🚧

API Deprecations

For APIs that have been moved to other classes or renamed, the old versions in the Instabug class have been deprecated and completely removed from the SDK, so please make sure to migrate all Instabug usage to the new APIs at the nearest opportunity.

Deprecated, Renamed, and Moved Methods

invoke

Previous Usage

Instabug.invoke();

New Usage

BugReporting.invoke();

invoke with specific mode:

Previous Usage

Instabug.invoke(InstabugInvocationMode);

New Usage

BugReporting.invoke(InvocationMode,InvocationOption)
  
// You can also specify invocation options 
EMAIL_FIELD_HIDDEN
EMAIL_FIELD_OPTIONAL
COMMENT_FIELD_REQUIRED
DISABLE_POST_SENDING_DIALOG

setSuccessDialogEnabled:

Previous Usage

Instabug.setSuccessDialogEnabled();

New Usage

BugReporting.setInvocationOptions(InvocationOption.DISABLE_POST_SENDING_DIALOG);

setCommentFieldRequired:

Previous Usage

Instabug.setCommentFieldRequired();

New Usage

BugReporting.setInvocationOptions(InvocationOption.COMMENT_FIELD_REQUIRED);

setEmailFieldVisibility:

Previous Usage

Instabug.setEmailFieldVisibility();

New Usage

BugReporting.setInvocationOptions(InvocationOption.EMAIL_FIELD_HIDDEN);

setPreInvocation:

Previous Usage

setPreInvocation(new Runnable() {
  @Override
  public void run() {
    // Code to called before the invocation 
  }
});

New Usage

BugReporting.setOnInvokeCallback(new OnInvokeCallback() {
            @Override
            public void onInvoke() {
               //do something
            }
}

setPreSendingRunnable:

Previous Usage

Instabug.setPreSendingRunnable(new Runnable() {
  @Override
  public void run() {
    // Attach logs and extra data to reports.
  }
});

New Usage

Instabug.onReportSubmitHandler(new Runnable() {
  @Override
  public void run() {
    // Attach logs and extra data to reports.
  }
});

changeInvocationEvent:

Previous Usage

Instabug.changeInvocationEvent(InstabugInvocationEvent.SHAKE);

New Usage

BugReporting.setInvocationEvents(InstabugInvocationEvent.SHAKE, InstabugInvocationEvent.SCREENSHOT)

setEmailFieldRequired:forAction:

Previous Usage

Instabug.setEmailFieldRequired(boolean, int);

New Usage

// For bug reports
BugReporting.setInvocationOptions(InvocationOption.EMAIL_FIELD_HIDDEN);

// For feature requests
FeatureRequests.setEmailFieldRequired(boolean, ActionType); 

// Available ActionTypes
REQUEST_NEW_FEATURE 
ADD_COMMENT_TO_FEATURE

setCommentFieldRequired:

Previous Usage

Instabug.setCommentFieldRequired(true);

New Usage

BugReporting.setInvocationOptions(InvocationOption.COMMENT_FIELD_REQUIRED);

// Can also be set to COMMENT_FIELD_OPTIONAL

setShakingThreshold:

Previous Usage

Instabug.setShakingThreshold(5);

New Usage

BugReporting.setShakingThreshold(5);

setFloatingButtonEdge

Previous Usage

Instabug.setFloatingButtonEdge(InstabugFloatingButtonEdge.RIGHT);

New Usage

BugReporting.setFloatingButtonEdge(InstabugFloatingButtonEdge.RIGHT);

setsetFloatingButtonOffsetFromTop:

Previous Usage

Instabug.setFloatingButtonOffsetFromTop(50);

New Usage

BugReporting.setFloatingButtonOffset(50);

setVideoRecordingFloatingButtonCorner:

Previous Usage

Instabug.setVideoRecordingFloatingButtonCorner(InstabugVideoRecordingButtonCorner.BOTTOM_LEFT);

New Usage

BugReporting.setVideoRecordingFloatingButtonPosition(InstabugVideoRecordingButtonPosition.BOTTOM_LEFT);

setChatNotificationEnabled:

Previous Usage

Instabug.setChatNotificationEnabled(false);

New Usage

Instabug.setReplyNotificationEnabled(false);

setNewMessageHandler:

Previous Usage

Instabug.setNewMessageHandler(new Runnable() {
  @Override
  public void run() {
    //Show an alert to notify users about a new message.
  }
});

New Usage

Instabug.setOnNewReplyRecievedCallback(new Runnable() {
  @Override
  public void run() {
    //Show an alert to notify users about a new message.
  }
});

setEnableSystemNotificationSound:

Instabug.setEnableSystemNotificationSound();

New Usage

Instabug.setSystemReplyNotificationSoundEnabled();

setEnableInAppNotificationSound:

Previous Usage

Instabug.setEnableInAppNotificationSound();

New Usage

Instabug.setInAppReplyNotificationSound();

setPromptOptionsEnabled:

Previous Usage

Instabug.setPromptOptionsEnabled(true, true, false);

New Usage

BugReporting.setPromptOptionsEnabled(PromptOption.CHAT, PromptOption.BUG, PromptOption.FEEDBACK);

setExtendedBugReportState:

Previous Usage

Instabug.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_REQUIRED_FIELDS);

New Usage

BugReporting.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_REQUIRED_FIELDS);

setOnSdkDismissedCallback:

Previous Usage

Instabug.setOnSdkDismissedCallback(new Runnable() {
	@Override
	public void run() {
	}
});

New Usage

BugReporting.setOnDismissCallback(new Runnable() {
	@Override
	public void run() {
	}
});

reportException:

Previous Usage

Instabug.reportException(new NullPointerException("Test issue"));

New Usage

CrashReporting.reportException(new NullPointerException("Test issue"));

reportException with String:

Previous Usage

Instabug.reportException(new NullPointerException("Test issue"), "Exception identifier");

New Usage

CrashReporting.reportException(new NullPointerException("Test issue"), "Exception identifier");

setSurveysAutoShowing:

Previous Usage

Instabug.setSurveysAutoShowing(false);

New Usage

Surveys.setAutoShowingEnabled(false);

showValidSurvey:

Previous Usage

Instabug.showValidSurvey();

New Usage

Surveys.showSurveyIfAvailable()

hasAvailableSurveys:

Previous Usage

Instabug.hasAvailableSurveys(); // Returns a boolean

New Usage

Surveys.getAvailableSurveys(); // Returns an array of survey objects, each with a getTitle() and show() method

setPreShowingSurveyRunnable:

Previous Usage

Instabug.setPreShowingSurveyRunnable(new Runnable() {
	@Override
	public void run() {
		//Pause game
	}
});

New Usage

Surveys.setOnShowCallback(new Runnable() {
	@Override
	public void run() {
		//Pause game
	}
});

setAfterShowingSurveyRunnable:

Previous Usage

Instabug.setAfterShowingSurveyRunnable(new Runnable() {
	@Override
	public void run() {
		//Start game
	}
});

New Usage

Surveys.setOnDismissCallback(new Runnable() {
	@Override
	public void run() {
		//Start game
	}
});

showSurveyWithToken:

Previous Usage

Instabug.showSurvey("TOKEN");

New Usage

Surveys.showSurvey("TOKEN");

setThresholdForReshowingSurveyAfterDismiss:

Previous Usage

Instabug.setThresholdForReshowingSurveyAfterDismiss(int sessionsCount, int daysCount);

New Usage

Surveys.setThresholdForReshowingSurveyAfterDismiss(int sessionsCount, int daysCount);

showFeatureRequests

Previous Usage

Instabug.showFeatureRequests();

New Usage

FeatureRequests.show();

hasRespondToSurvey

Previous Usage

Instabug.hasRespondToSurvey("TOKEN"); // Returns a boolean

New Usage

Surveys.hasRespondToSurvey("TOKEN"); // Returns a boolean

setShouldShowSurveysWelcomeScreen:

Previous Usage

Instabug.setShouldShowSurveysWelcomeScreen(true);

New Usage

Surveys.setShouldShowWelcomeScreen(true);

setTheme:

Previous Usage

Instabug.setTheme(InstabugColorTheme.InstabugColorThemeLight);

New Usage

Instabug.setColorTheme(InstabugColorTheme.InstabugColorThemeLight);

Removed Methods

Below is a list of methods that were removed with no alternatives.

Instabug.setWillSkipScreenshotAnnotation(); // Screenshot annotation step is no longer presented when reporting a bug.
Instabug.clearExtraReportFields();
Instabug.setDefaultInvocationMode();
Instabug.resetDefaultInvocationMode();

New Methods

FeatureRequests.setEmailFieldRequired:

Use to set whether email is required or not when adding a new feature or adding a comment in feature requests.

FeatureRequests.setEmailFieldRequired(boolean, ActionType); 

// Available ActionTypes
REQUEST_NEW_FEATURE 
ADD_COMMENT_TO_FEATURE

New Properties

BugReporting.setInvocationOptions

BugReporting.setInvocationOptions(InvocationOption.EMAIL_FIELD_OPTIONAL , InvocationOption.DISABLE_POST_SENDING_DIALOG);

New Types

InvocationOption

An enum to be used with BugReporting.setInvocationOptions() and BugReporting.invoke(InvocationMode,InvocationOption). Possible values are:

  • InvocationOption.EMAIL_FIELD_HIDDEN
  • InvocationOption.EMAIL_FIELD_OPTIONAL
  • InvocationOption.COMMENT_FIELD_REQUIRED
  • InvocationOption.DISABLE_POST_SENDING_DIALOG