Android SDK

This tutorial provides you with a step-by-step guide to configuring your Android SDK in your mobile application.

We will start on configuring your app in your HelpCrunch profile, then proceed to implementing and configuring HelpCrunch SDK in your Android project, and finally, we’ll describe how to create a push-enabled Android application.

1. Configuring app on your HelpCrunch profile

Create a new app

To add a new app, open Settings page in your HelpCrunch account and press “Add application”.

2. Adding SDK to your project

  1. Add the following code to your Gradle file compile

    compile ('com.helpcrunch:helpcrunch-sdk:1.+@aar') {
    or Maven

  2. Initialize the Helpcrunch in your custom application class

    You can copy this code on apps list in your HelpCrunch account
  3. To show the HelpCrunch UI simply call the showChatScreen helper method on HelpCrunch:
    HelpCrunch.showChatScreen(Context context)

3. Enable Push Notifications (optional)

We believe that push notifications is a great way to add real-time messaging to your application and inform your app users that there is a new message came from HelpCrunch server (i.e. from your admin dashboard). It allows you to stay in touch with your users even when the application is not in the foreground. Although, HelpCrunch Mobile SDK does not necessary require the implementation of push notifications and end users of your application will still be able to receive messages, but in this case, the end users will discover that new messages arrived only after opening HelpCrunch page.

  1. Create a new project in Google Developer Console
  2. Init HelpCrunch SDK with Google Project ID

  3. Enable “Cloud Messaging for Android” in Mobile APIs
  4. Create API key in APIs Credentials. Choose “Server key”
  5. Open Settings page in your HelpCrunch account and set API key to application

4. App Users

By default HelpCrunch SDK requires a user to enter his name before sending messages. You can disable this with initializing Helpcrunch with custom options:

HelpCrunch.Options opts = new HelpCrunch.Options();
opts.requestName = false;

Saving app user data to HelpCrunch is done by calling HelpCrunch.updateUser(User user, Callback callback)

User c = new UserBuilder()

HelpCrunch lets you send custom attributes about your customers. The custom attributes allow to send any information you wish to track about users. Send Map containing any data about users and setup displaying and filters in HelpCrunch admin panel settings

Map custom = new HashMap();
custom.put("CUSTOM_TIME", System.currentTimeMillis());
HelpCrunch.updateUser(new UserBuilder().withCustomData(custom).build(), null);

You can get app user data from HelpCrunch by calling

User user = HelpCrunch.getStorage().loadUser();