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 https://github.com/Instabug/instabug-cordova
Using Instabug
iOS
To start using Instabug, you will need to initialize the SDK in your app. This can be done through the activate
method. 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.
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.
Optional Parameters
A third parameter is an optional object containing properties to set a variety of configurations.
Here is a sample showing how to use Instabug.
cordova.plugins.instabug.activate(
{
ios: 'MY_IOS_TOKEN'
},
'shake',
{
commentRequired: true,
colorTheme: 'dark'
},
function () {
console.log('Instabug initialized.');
},
function (error) {
console.log('Instabug could not be initialized - ' + error);
}
);
Android
To start using the SDK in your Android app, follow these steps:
- Change the name of the application class in your
AndroidManifest.xml
file toandroid:name="com.instabug.cordova.plugin.MyApplication"
- Then, you only need to add your app token in the
MyApplication
class, by replacingYOUR_ANDROID_TOKEN
with your app token.
Class Location
You can find this class under this path
YourProjectName/platforms/android/app/src/main/java/com.instabug.cordova.plugin/MyApplication.java
Your builder method should look like this:
@Override
public void onCreate(){
new Instabug.Builder(
this,
"INSTABUG_TOKEN",
InstabugInvocationEvent.SHAKE
).build();
}
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
.
iOS
To start using Instabug, you will need to initialize the SDK in your app. This can be done through the activate
method. 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.
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.
Optional Parameters
A third parameter is an optional object containing properties to set a variety of configurations.
Here is a sample showing how to use Instabug.
cordova.plugins.instabug.activate(
{
ios: 'MY_IOS_TOKEN'
},
'shake',
{
commentRequired: true,
colorTheme: 'dark'
},
function () {
console.log('Instabug initialized.');
},
function (error) {
console.log('Instabug could not be initialized - ' + error);
}
);
Android
To start using the SDK in your Android app, follow these steps:
1 - Change the name of the application class in your AndroidManifest.xml
file to android:name="com.instabug.cordova.plugin.MyApplication"
2 - Then, you only need to add your app token in the MyApplication
class, by replacing YOUR_ANDROID_TOKEN
with your app token.
Class Location
You can find this class under this path
YourProjectName/platforms/android/app/src/main/java/com.instabug.cordova.plugin/MyApplication.java
Your builder method should look like this:
@Override
public void onCreate(){
new Instabug.Builder(
this,
"INSTABUG_TOKEN",
InstabugInvocationEvent.SHAKE
).build();
}
You can find your app token by selecting SDK Integration in the Settings menu from your Instabug dashboard.
Updated almost 5 years ago
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.