Android Integration

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

Installation

You need to import the plugin from the Asset Store.

2169

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. Make sure you're using the latest build tool and Gradle versions.

🚧

Min SDK Version

The minSdkVersion must be version 21 or higher.

  1. Create a new Application.java class that should look like this. Add your app token, and change the invocation event from this class.
...
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")
                .setInvocationEvents(InstabugInvocationEvent.SHAKE)
                .build();
        BugReporting.setScreenshotByMediaProjectionEnabled(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>

App token

To find your application token, open your Instabug Dashboard, select an application, then open the SDK tab.

Invocation Event

You can use this parameter to specify how your users will invoke the SDK to send you a report. For more details about the invocation events, check here. You can find all the different invocation methods below.

InstabugInvocationEvent.NONE
InstabugInvocationEvent.SHAKE
InstabugInvocationEvent.FLOATING_BUTTON
InstabugInvocationEvent.SCREENSHOT