SDK Integration

This document provides steps for integrating your browser with Hackle via the Hackle SDK for apps created with React Native. SDK Integration is a must in order to use the functions we provide.

Step 1: Add Dependencies

Think of this step as importing and installing our SDK into your codebase. To use our Hackle services add the following dependency code and import our SDK.

npm install --save @hackler/react-native-sdk

react-native link

cd ios
pod install

📘

Rebuild your app after Step 1

React Native SDK includes Android and iOS SDKs.
The app that is being tested has to be newly built in order to make sure that Step 1 is complete.

Step 2: Initialize the SDK

Once you have imported the dependencies, in order to start using the Hackle SDK you must initialize the SDK. During this step, we get the information needed for SDK integration from the Hackle Server and store it in the SDK.

You need to pass the SDK key to createInstance() to create a HackleReactNativeSDKClient and pass it on to the HackleProvider that wraps the React application.

The SDK key can be found in the SDK integration in the dashboard of Hackle service.

Communication for data synchronization with the Hackle server is carried out during the application initialization stage. Typically, this only takes a few milliseconds. Rendering begins immediately after synchronization is complete.

import { createInstance, HackleProvider } from "@hackler/react-native-sdk";

// Enter the SDK Key in the YOUR_BROWSER_SDK_KEY.
const hackleClient = createInstance("YOUR_APP_SDK_KEY");

const App: () => React$Node = () => {
  return (
        <HackleProvider hackleClient={hackleClient} timeout={1000}>
          <YourApp />
        </HackleProvider>
    );
};