Instabug

Integration

Installation

This section explains how to install Instabug SDK into your React Native application.
If you are upgrading, check the Upgrade Guide before bumping to a new major version.

  1. Open the command line and navigate to your React Native Directory. Then, run the following command.
npm install instabug-reactnative
  1. Link the bridging files in the npm package to the ios project use the following command. Make sure you have Ruby installed before running this last command (You can skip installing Ruby if you're building an Android app only).
react-native link instabug-reactnative

Upgrading from 1.x.x

When upgrading from version 1.x.x please make sure you do the following steps:

  1. Open the command line and navigate to your React Native Directory. Then, run the following command.
npm install instabug-reactnative
  1. Open your Pod file and delete this line pod 'Instabug', '~> 7.0'

  2. Run this command from inside the ios directory inside your root project's directory

pod install
  1. Run this command from your root project's directory.
    Make sure you have Ruby installed before running this last command (You can skip installing Ruby if you're building an Android app only).
react-native link instabug-reactnative

Using Instabug

  1. To start using Instabug, import it into your index.ios.js and index.android.js file.
import Instabug from 'instabug-reactnative';
  1. Then initialize it in the constructor or componentWillMount. This line will let the Instabug SDK work with the default behavior. The SDK will be invoked when the device is shaken. You can customize this behavior through the APIs (You can skip this step if you are building an Android app only).
Instabug.startWithToken('IOS_APP_TOKEN', Instabug.invocationEvent.shake);
  1. Open android/app/src/main/java/[...]/MainApplication.java, locate the getPackages method. and add your Android app token. You can skip this step if you are building an iOS app only.
@Override
protected List<ReactPackage> getPackages() {
	return Arrays.<ReactPackage>asList(
	new MainReactPackage(),
	new RNInstabugReactnativePackage.Builder("YOUR_APP_TOKEN", MainApplication.this)
    		.setInvocationEvent("shake")
    		.setPrimaryColor("#1D82DC")
    		.setFloatingEdge("left")
    		.setFloatingButtonOffsetFromTop(250)
    		.build()
}

You can find your app token by selecting the SDK tab from your Instabug dashboard.

Same Build for Beta and App Store

The following method handles both cases: when the app is running live from the App Store and if it is running from the simulator, Xcode, Fabric Beta or Test Flight.

Instabug.isRunningLive(function (isLive) {
  if (isLive) {
    Instabug.startWithToken('LIVE_TOKEN', Instabug.invocationEvent.none);
  } else {
    Instabug.startWithToken('BETA_TOKEN', Instabug.invocationEvent.screenshot);
  }
});

Integration