SDK 11.0 Migration Guide
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
| Module | Using cordova.require (Recommended) | Using window |
|---|---|---|
Instabug | cordova.require("instabug-cordova.Instabug") | window.InstabugLib.Instabug |
BugReporting | cordova.require("instabug-cordova.BugReporting") | window.InstabugLib.BugReporting |
FeatureRequests | cordova.require("instabug-cordova.FeatureRequests | window.InstabugLib.FeatureRequests |
Surveys | cordova.require("instabug-cordova.Surveys | window.InstabugLib.Surveys |
Replies | cordova.require("instabug-cordova.Replies | window.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
- If you have checked
platform/androidin your source control, then remove the following attribute fromplatforms/android/app/src/main/AndroidManifest.xml:
android:name="com.instabug.cordova.plugin.MyApplication"
- Initialize Instabug in your JS, inside the
onDeviceReadyfunction, by replacing calls forInstabug.activatewithInstabug.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);
}
);
- Replace
Instabug.activateoptions with the alternative JS API:
| Key | Alternative JS API |
|---|---|
shakingThresholdIPhone | BugReporting.setShakingThresholdForiPhone |
shakingThresholdIPad | BugReporting.setShakingThresholdForiPad |
floatingButtonEdgefloatingButtonOffset | BugReporting.setFloatingButtonEdge |
enableSessionProfiler | Instabug.setSessionProfilerEnabled |
colorTheme | Instabug.setColorTheme |
welcomeMessageMode | Instabug.setWelcomeMessageMode |
Remove the deprecated APIs
BugReporting Module
| Removed | Alternative |
|---|---|
invocationOptions enum | option enum |
setInvocationOptions | setOptions |
Chats Module
Completely removed. Use Replies Module instead.
Instabug Module
| Removed | Alternative |
|---|---|
startWithToken | start |
activate | start |
getUnreadMessagesCount | Replies.getUnreadRepliesCount |
setChatNotificationEnabled | Replies.setInAppNotificationEnabled |
Breaking Changes
Some APIs were removed or moved to another module:
- Remove
Instabug.setAutoScreenRecordingMaxDuration - Remove
Surveys.setThresholdForReshowingSurveyAfterDismiss - Remove
Instabug.setViewHierarchyEnabled - Remove
BugReporting.invocationModesenum. - Replace
Instabug.setVideoRecordingFloatingButtonPositionwithBugReporting.setVideoRecordingFloatingButtonPosition - Replace
Instabug.setShakingThresholdwithBugReporting.setShakingThresholdForAndroid
Updated over 3 years ago
