HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

SDK 11.0 Migration Guide for Cordova

This page covers the migration steps from previous versions of the SDK to Instabug Version 11.0+ for Cordova and Ionic apps.

Importing the Plugin

Prior to v11, Instabug modules were polluting the plugins object and may clash with other libraries (thanks to Edmu for highlighting it here)

So instead of using the modules like this:

cordova.plugins.bugReporting.setEnabled(...);

Now you can use it with cordova.require as follows:

var BugReporting = cordova.require("instabug-cordova.BugReporting");

BugReporting.setEnabled(...);

Or if you prefer to use the window object:

var BugReporting = window.InstabugLib.BugReporting;

Available Modules

ModuleUsing cordova.require (Recommended)Using window
Instabugcordova.require("instabug-cordova.Instabug")window.InstabugLib.Instabug
BugReportingcordova.require("instabug-cordova.BugReporting")window.InstabugLib.BugReporting
FeatureRequestscordova.require("instabug-cordova.FeatureRequestswindow.InstabugLib.FeatureRequests
Surveyscordova.require("instabug-cordova.Surveyswindow.InstabugLib.Surveys
Repliescordova.require("instabug-cordova.Replieswindow.InstabugLib.Replies

Start the SDK from JS only

Users are now able to initialize the SDK completely from Javascript rather than having to write the initialization code for Android in the Java/Kotlin files.

Migrate the initialization code to JS

  1. If you have checked platform/android in your source control, then remove the following attribute from platforms/android/app/src/main/AndroidManifest.xml:
android:name="com.instabug.cordova.plugin.MyApplication"
  1. Initialize Instabug in your JS, inside the onDeviceReady function, by replacing calls for Instabug.activate with Instabug.start
function onDeviceReady() {
  var Instabug = cordova.require("instabug-cordova.Instabug");
  var BugReporting = cordova.require("instabug-cordova.BugReporting");

  Instabug.start(
    'APP_TOKEN',
    function () {
    	console.log('Instabug initialized.');
    },
    function (error) {
    	console.log('Instabug could not be initialized - ' + error);
    }
  );
}
import { Instabug, BugReporting } from "instabug-cordova";

Instabug.start(
    'APP_TOKEN',
    [BugReporting.invocationEvents.button],
  	function () {
    	console.log('Instabug initialized.');
    },
    function (error) {
   		console.log('Instabug could not be initialized - ' + error);
    }
);
  1. Replace Instabug.activate options with the alternative JS API:
KeyAlternative JS API
shakingThresholdIPhoneBugReporting.setShakingThresholdForiPhone
shakingThresholdIPadBugReporting.setShakingThresholdForiPad
floatingButtonEdge
floatingButtonOffset
BugReporting.setFloatingButtonEdge
enableSessionProfilerInstabug.setSessionProfilerEnabled
colorThemeInstabug.setColorTheme
welcomeMessageModeInstabug.setWelcomeMessageMode

Remove the deprecated APIs

BugReporting Module

RemovedAlternative
invocationOptions enumoption enum
setInvocationOptionssetOptions

Chats Module

Completely removed. Use Replies Module instead.

Instabug Module

RemovedAlternative
startWithTokenstart
activatestart
getUnreadMessagesCountReplies.getUnreadRepliesCount
setChatNotificationEnabledReplies.setInAppNotificationEnabled

Breaking Changes

Some APIs were removed or moved to another module:

  1. Remove Instabug.setAutoScreenRecordingMaxDuration
  2. Remove Surveys.setThresholdForReshowingSurveyAfterDismiss
  3. Remove Instabug.setViewHierarchyEnabled
  4. Remove BugReporting.invocationModes enum.
  5. Replace Instabug.setVideoRecordingFloatingButtonPosition with BugReporting.setVideoRecordingFloatingButtonPosition
  6. Replace Instabug.setShakingThreshold with BugReporting.setShakingThresholdForAndroid