Skip to main content
Skip table of contents

SDK: for Android Apps using Native

Dropthought SDK helps you collect feedback or responses to your created programs. All you need to do is install the SDK using our APIs. The integration also enables you to collect metadata and feedback offline.

This article will help you understand:

  1. How do you integrate Dropthought SDK into your application?

  2. What are the prerequisites for integrating the application?

  3. How do you install SDK for integrating into your Android apps?

  4. What steps are involved in installing and initializing SDK use?

  5. What are the additional features?


Scenario

While using Dropthought, you can create and manage programs via web or mobile apps.

You have an online shopping platform and would like to gather customers' online shopping experience upon placing an order via your app. 

To improve user experience, you can have your widget and link it to a program (survey) created on Dropthought.

How do you do that?
Upon creating a program on Dropthought, you need to connect the program to the interactive element using SDK. 

User Flow

To help you with a generic user flow:

  1. Create a program on Dropthought.

  2. Use the API key provided within your Account Profile.

  3. Install SDK using the API key.

  4. Navigate to the mobile app and go to Manage Native SDK.

  5. Add or select the app from the following screen.

  6. Create visibility. It helps identify the placement of the element or widget within the selected app.

  7. Select the program you want to use for the program.

  8. The program can now capture responses from the selected app.

 

Pre-requisites 

  1. Use react-native version above 0.64.1

  2. API key from your Dropthought account:
    If you can’t find an API key inside the Account screen of your Dropthought web application account, reach out to the 'Account Administrator.'
    If your Account Administrator can’t find the API key on their Dropthought account, contact us at cs@drophought.com.

  3. Visibility ID from the Dropthought mobile app. Refer to the following sections to fetch the API key and Visibility ID.

Installing & Setting-up SDK

Installing and setting up SDK can be summarised as a three-step process:

  1. Fetching API Key from your Dropthought Account

  2. Installing SDK

  3. Initialize

Step 1: Fetching API Key from your Dropthought Account

  1. Navigate to the Account tab.

     

  2. Click on Account and then go to Account Profile.

 

  1. You will find the API key.

 

Step 2: Installing the SDK

Project Setup

  1. Open the settings.gradle file for the project.

  2. Add Dropthought’s maven repo to repositories.

CODE
allprojects {

    repositories {

        // Add Dropthought's maven repo to repositories

+       maven {

+           url "https://dropthought-sdk.s3.amazonaws.com/releases/"

+       }

        // ...

        google()

+       mavenCentral{

+           // We don't want to fetch react-native from Maven Central as there are older versions over there.

+           content {

+               excludeGroup "com.facebook.react"

+           }

+       }

    }

}
  1. Go to your module's app/build.gradle file.

  2. Add dropthought SDK dependency and handle appcompat:1.3.1:

CODE
dependencies {

// In RN 0.64, TextView might crash without below changes

implementation 'androidx.appcompat:appcompat:1.4.1'

+   implementation ("androidx.appcompat:appcompat:1.3.1") {

+       version {

+           strictly '1.3.1'

+       }

+   }

    ...

    // add dropthought sdk dependency

+   implementation "com.dropthought.app:dt-sdk:5.1.0"

}

 

Step 3: Initialize

Call Dropthought.init() inside your onCreate method of MainActivity.java to initialize Dropthought.

CODE
package com.dropthought.sdk.sampleapp;

import androidx.appcompat.app.AppCompatActivity;

// import dropthought package

+import com.dropthought.app.sdk.Dropthought;

public class MainActivity extends AppCompatActivity {

    ...

    @Override

    public void onCreate() {

        super.onCreate();

        setContentView(R.layout.activity_main);

        // call Dropthought.init(Activity, YOUR_API_KEY) inside onCreate method

        // Remember: you must supply the activity (e.g. this)

+       Dropthought.init(

+               this,

+               YOUR_API_KEY

+       );

        ...

    }

}

Dropthought’s SDK is now installed and initialized on your Dropthought mobile app.


feedback-img.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.