HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

Integrating Instabug

This page covers how to install the Instabug SDK into your regular and Ionic Cordova applications.

Cordova Installation Steps

Installation

Open the command line and navigate to your project directory. Then run the following command.

cordova plugin add instabug-cordova

Using Instabug

To start using Instabug, you will need to initialize the SDK in your app. This can be done through the activate method on iOS or the Android plug-in. It takes as your app token as a parameter, your selected invocation event, and a range of optional parameters. It also takes two callback functions, one for success and another one in case of failure.

iOS

In order to initialize Instabug on iOS, you'll need to add the following code in your JS class:

cordova.plugins.instabug.activate(
    {
        ios: 'MY_IOS_TOKEN'
    },
    'shake',
    function () {
        console.log('Instabug initialized.');
    },
    function (error) {
        console.log('Instabug could not be initialized - ' + error);
    }
);

Android

A series of steps will be required in order to get Instabug up and running on Android:
1 - Change the name of the application class in your AndroidManifest.xml file to android:name="com.instabug.cordova.plugin.MyApplication".

📘

Cordova Android 7.0 and above

Starting from Cordova Android v7.0.0 AndroidManifest.xml location has been changed and its new path now is app/src/main/AndroidManifest.xml (read more).

If you're using _Cordova Android v7+, please make sure you update its location inside Cordova's build.gradle file at platforms/android/CordovaLib/build.gradle:

sourceSets {
        main {
            manifest.srcFile 'src/main/AndroidManifest.xml'
        }
    }

2 - Add your app token in the MyApplication class by replacing "YOUR_ANDROID_TOKEN" (this can be found under the following path YourProjectName/platforms/android/app/src/main/java/com.instabug.cordova.plugin/MyApplication.java)
3 - Make sure the following snippet is added to your project level build.gradle:

allprojects {
	repositories {
	    maven {
	        url "https://sdks.instabug.com/nexus/repository/instabug-cp"
	    }
	}
}

Invocation Event

Using this parameter, you specify how your users will show the SDK to send you a report. For more details, see the Showing Instabug section.

Like the app token, the value itself can be provided, or you can give an object with values according to platforms.

You can find your app token by selecting SDK Integration in the Settings menu from your Instabug dashboard.

Ionic Installation Steps

Installation

Open the command line and navigate to your project directory. Then run the following command.

ionic cordova plugin add instabug-cordova

Using Instabug

You will first need to add declare let cordova: any; at the beginning of your app.component.ts class.

To start using Instabug, you will need to initialize the SDK in your app. This can be done through the activate method on iOS or the Android plug-in. It takes as your app token as a parameter, your selected invocation event, and a range of optional parameters. It also takes two callback functions, one for success and another one in case of failure.

iOS

In order to initialize Instabug on iOS, you'll need to add the following code in your JS class:

cordova.plugins.instabug.activate(
    {
        ios: 'MY_IOS_TOKEN'
    },
    'shake',
    function () {
        console.log('Instabug initialized.');
    },
    function (error) {
        console.log('Instabug could not be initialized - ' + error);
    }
);

Android

A series of steps will be required in order to get Instabug up and running on Android:
1 - Change the name of the application class in your AndroidManifest.xml file to android:name="com.instabug.cordova.plugin.MyApplication".

📘

Cordova Android 7.0 and above

Starting from Cordova Android v7.0.0 AndroidManifest.xml location has been changed and its new path now is app/src/main/AndroidManifest.xml (read more).

If you're using _Cordova Android v7+, please make sure you update its location inside Cordova's build.gradle file at platforms/android/CordovaLib/build.gradle:

sourceSets {
        main {
            manifest.srcFile 'src/main/AndroidManifest.xml'
        }
    }

2 - Add your app token in the MyApplication class by replacing "YOUR_ANDROID_TOKEN" (this can be found under the following path YourProjectName/platforms/android/app/src/main/java/com.instabug.cordova.plugin/MyApplication.java)
3 - Make sure the following snippet is added to your project level build.gradle:

allprojects {
	repositories {
	    maven {
	        url "https://sdks.instabug.com/nexus/repository/instabug-cp"
	    }
	}
}

Invocation Event

Using this parameter, you specify how your users will show the SDK to send you a report. For more details, see the Showing Instabug section.

Like the app token, the value itself can be provided, or you can give an object with values according to platforms.

You can find your app token by selecting SDK Integration in the Settings menu from your Instabug dashboard.


What’s Next

Now that you've successfully integrated Instabug, check out how to show Instabug using different methods, how to identify your users, and how to customize your SDK.