Hello 👋 How can we help?

Adding SDK to your project

Written by Konstantine
Updated 1 month ago

You can add HelpCrunch SDK to your Android application with Gradle or Maven build systems:

1. Add the following code to your Gradle file compile

implementation ('com.helpcrunch:helpcrunch-sdk:1.5.2') { transitive=true } 

or Maven:

<dependency>
  <groupId>com.helpcrunch</groupId>
  <artifactId>helpcrunch-sdk</artifactId>
  <version>1.5.4</version>
</dependency>

2. For the next step you’ll need the Android Initialization Code. You can copy this code on apps list in your HelpCrunch account (Settings page → Set up & Customize → Android APPs → Your app name → Android Initialization Code)

3. Initialize the Helpcrunch in your custom application class with your Android Initialization Code

HelpCrunch.initialize(this, YOUR_HELPCRUNCH_SUBDOMAIN, YOUR_APP_ID, YOUR_APP_SECRET);

In your IDE it would look like this:

4. It is important. Add a File Provider to share media files:

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="${applicationId}.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths"/>
</provider>

provider_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-files-path name="external_files" path="."/>
    <external-files-path name="my_images" path="my_images" />
</paths>

To show the HelpCrunch UI after you have initialized it, simply call the showChatScreen helper method on HelpCrunch:

HelpCrunch.showChatScreen(Context context)

6. After you have called the method it will look like this:

Did this answer your question?