Integrating Instabug

This page covers how to install the Instabug SDK in your Android application.

🚧

Compile SDK Version

Please note that the compileSDKVersion should be v29 or above, otherwise you may run into build errors.

Installation

Below are the ways you can add Instabug to your project.

Gradle

Add this line to your build.gradle file.

implementation 'com.instabug.library:instabug:10.4.3'

Maven

<dependency>
      <groupId>com.instabug.library</groupId>
      <artifactId>instabug</artifactId>
      <version>10.4.3</version>
</dependency>

Using Instabug

In your Application class add this line to your onCreate method. This initializes Instabug with the default invocation event, Shake.

new Instabug.Builder(this, "APP_TOKEN").build();
Instabug.Builder(this, "APP_TOKEN").build()

Initializing Instabug in your application can also be done using one or multiple invocation events. All possible invocation events are explained in the invocation section.

new Instabug.Builder(this, "APP_TOKEN")
	.setInvocationEvents(InstabugInvocationEvent.SHAKE, InstabugInvocationEvent.SCREENSHOT)
	.build();
Instabug.Builder(this, "APP_TOKEN")
            .setInvocationEvents(InstabugInvocationEvent.SHAKE, InstabugInvocationEvent.FLOATING_BUTTON)
            .build()

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

Permissions

Permissions are automatically added to your AndroidManifest.xml file. Some of them are required to be able to fetch information like network and WiFi connection. Others are used to allow your users to attach images, videos, and audio recordings. In general, permission requests don't appear unless your user attempts to use a feature requiring a permission.

The only exception is if you set the invocation event to be a Screenshot. In that case, the storage permission will be requested when your application launches. The screenshot invocation is a special case because there is no native event that tells the SDK that a screenshot has been captured. The only way to know is to monitor the screenshots directory. The SDK is invoked when a screenshot is added to the directory while your application is active.

<uses-permission android:name=“android.permission.ACCESS_NETWORK_STATE” />
<uses-permission android:name=“android.permission.WRITE_EXTERNAL_STORAGE” />
<uses-permission android:name=“android.permission.READ_EXTERNAL_STORAGE” />
<uses-permission android:name=“android.permission.ACCESS_WIFI_STATE” />
<uses-permission android:name=“android.permission.RECORD_AUDIO” />
<uses-permission android:name=“android.permission.MODIFY_AUDIO_SETTINGS” />
<uses-permission android:name=“android.permission.INTERNET” />
<uses-permission android:name=“android.permission.WAKE_LOCK” />

You can remove any of the permissions if you will not be using the feature associated with it, as in the following example.

<uses-permission android:name=“android.permission.WRITE_EXTERNAL_STORAGE” tools:node=“remove”/>

🚧

Required Permissions

There are a few permissions that are always required and cannot be removed. These permissions are:
<uses-permission android:name=“android.permission.WAKE_LOCK”/>
<uses-permission android:name=“android.permission.INTERNET”/>


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 the SDK.