Chatbox SDKs
Give Feedback

Android Chat SDK

Updated on March 26, 2024

Looking to add a Chat SDK to your Android mobile app? Start with Crisp today and elevate your customer support with our Android Chat widget — Install it in just a few steps.

Looking for the extensive Java documentation? It is available here.

Video Tutorial

Introduction Video


Installation

1. Get your Website ID

Go to your Crisp Dashboard, and copy your Website ID:

Copy your Website ID

2. Add Crisp dependency

Add the Crisp Android Chat SDK in your dependencies:

dependencies {
    implementation 'im.crisp:crisp-sdk:2.0.0beta1'
}

3. Setup multidex

Configure your app for multidex:

android {
    defaultConfig {
        multiDexEnabled true
    }
}
dependencies {
    // If you're using AndroidX
    implementation 'androidx.multidex:multidex:2.0.1'
    // If you're not using AndroidX
    implementation 'com.android.support:multidex:1.0.3'
}

4. Initiate the application class

Initialize the library in your Application subclass:

public class Initializer extends MultiDexApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        // Replace it with your WEBSITE_ID
        // Retrieve it using https://app.crisp.chat/website/[YOUR_WEBSITE_ID]/
        Crisp.configure(getApplicationContext(), "7598bf86-9ebb-46bc-8c61-be8929bbf93d");
    }
}

5. Include Crisp in your activity

You can for instance start Crisp after a click on a button:

Intent crispIntent = new Intent(this, ChatActivity.class);
startActivity(crispIntent);

Availables APIs

Java APIs

The extensive Java documentation is available here.

  • Crisp.configure(Context applicationContext, String websiteID, @Nullable String tokenID) — Configures Crisp SDK with your websiteID and optionally your user's tokenID
  • Crisp.setTokenID(Context applicationContext, @Nullable String tokenID) — Assigns the next session with a tokenID
  • Crisp.resetChatSession(Context applicationContext) — Reset the session
  • Crisp.getSessionIdentifier(Context) — Returns the sessionID
  • Crisp.setUserEmail(String email) — Sets the user email (note: if email is invalid, this method will return false and the value will not be set)
  • Crisp.setUserPhone(String phone) — Sets the user phone (note: if phone is invalid, this method will return false and the value will not be set)
  • Crisp.setUserNickname(String nickname) — Sets the user name
  • Crisp.setUserAvatar(String avatar) — Sets the user avatar (note: if avatar is invalid, this method will return false and the value will not be set)
  • Crisp.setUserCompany(Company company) — Sets the user company
  • Crisp.setSessionBool(String key, boolean value) — Sets a session data boolean
  • Crisp.setSessionInt(String key, int value) — Sets a session data integer
  • Crisp.setSessionString(String key, String value) — Sets a session data string
  • Crisp.setSessionSegment(String segment, boolean overwrite) — Sets a session segment and optionally overwrite existing ones (default is false)
  • Crisp.setSessionSegments(List<String> segments, boolean overwrite) — Sets a collection of session segments and optionally overwrite existing ones (default is false)
  • Crisp.pushSessionEvent(SessionEvent event) — Pushes a event
  • Crisp.pushSessionEvents(List<SessionEvent> events) — Pushes a collection of events
  • Crisp.searchHelpdesk(Context applicationContext) — Opens the Helpdesk search tab
  • Crisp.openHelpdeskArticle(Context applicationContext, String id, String locale, @Nullable String title, @Nullable String category) — Displays the targeted article (optionally sets a title and category)

Important notes

Calls to setUser, setSession and pushSessionEvent methods are performed right away if the chat is already ongoing, when the session is joined, or if you call either of configure (with a different websiteID than the current one) or resetChatSession.
Calls to helpdesk methods are performed right away if the chat is already ongoing, on the next opening, or if you call either of configure (with a different websiteID than the current one), resetChatSession or any other helpdesk methods.
Calling configure(Context, String) or configure(Context, String, String) with a null tokenID value will set it to null. This means that calls to setTokenID must be done after configure and before starting ChatActivity, otherwise the session will be created without it and you will need to call resetChatSession afterwards. Calls to configure and setTokenID are ignored if the chat is already ongoing.