Integration for Android

This page explains how to install Instabug's SDK into your Unity application.

Installation

You need to import the plugin from the Asset Store.

Using Instabug for Unity

Create the plugin's GameObject

  1. Create an empty game object (GameObject -> Create Empty) and rename it (e.g. InstabugAndroid ).
  2. Add the InstabugAndroid.cs as a component of your new created game object.

Configure build settings

  1. Export your Unity project by opening Build Settings from “File —> Build Settings”, and checking the Export button. Choose your desired path to save the project.
  2. Open the exported project from Android Studio, and add the following changes to the build.gradle file.
allprojects {
   repositories {
      jcenter()
      google()
      maven {
            // TODO add this only if interested in getting SNAPSHOT releases
            url "https://oss.sonatype.org/content/repositories/snapshots"
      }
      ...
   }
}
...
dependencies {
  ...
   compile 'com.instabug.library:instabug:5.0.0.3.19-SNAPSHOT'
}
...
  1. Create a new Application.java class that should look like this. Add your app token, and change the invocation event from this class.

App token

To find your application token, open you Instabug dashboard. Select an application. Then, open the SDK tab.

Invocation Event

Using this parameter you specify how your users will invoke the SDK to send you a report. For more details about the invocation check this link.

...
import android.app.Application;

import com.instabug.library.Instabug;
import com.instabug.library.invocation.InstabugInvocationEvent;
...
public class MyApp extends Application {
  @Override
  public void onCreate() {
        super.onCreate();

		// You can change the invocation event to NONE, FLOATING_BUTTON,
		// SCREENSHOT_GESTURE, or TWO_FINGER_SWIPE_LEFT.
        new Instabug.Builder(this, "YOUR_APP_TOKEN")
                .setInvocationEvent(InstabugInvocationEvent.SHAKE)
                .build();
        Instabug.setUnityEnabled(true);
    }
}
  1. Add the Application class name to the AndroidManifest.xml file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...>
...
  <application android:name=".MyApp" ...>
  ...
  </application>
  ...
</manifest>