Hyphenate Docs

Start Chatting with Hyphenate!

Welcome to the Hyphenate docs portal. Here you'll find comprehensive guides and technical documentation to help you integrate Hyphenate In-App Chat.

Get Started

Install the Android SDK

Demo App

Install SDK with Gradle

Add the following code to the file build.gradle under your Android Studio project:

android {
    // use legacy for for android 6.0
    useLibrary 'org.apache.http.legacy'
}

repositories {
    maven { url "https://raw.githubusercontent.com/HyphenateInc/Hyphenate-SDK-Android/master/repository" }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.4.0'

    // GCM (Google Cloud Messaging).
    compile 'com.google.android.gms:play-services-gcm:9.4.0'

    compile 'com.hyphenate:hyphenate-sdk:3.1.5'
}

Notes

  • If you want to use the version of SDK without voice/video calling, use compile 'com.hyphenate:hyphenate-sdk-lite:3.1.5'.
  • The latest version of the SDK can be found at: Github

Manifest configuration

Add the following permission and registered appkey to the manifest file AndroidManifest.xml.

Permission configuration (to configure other permissions, please refer to the demo):

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="Your Package"
    android:versionCode="100"
    android:versionName="1.0.0">

    <!-- Required -->
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>  
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <!-- GCM required, replace "com.hyphenate.chatuidemo" with your own package-->
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <permission 
        android:name="com.hyphenate.chatuidemo.permission.C2D_MESSAGE"
        android:protectionLevel="signature"
        />
    <uses-permission android:name="com.hyphenate.chatuidemo.permission.C2D_MESSAGE" />

     <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:name="Your Application">

       <!-- Set appkey -->
        <meta-data android:name="Hyphenate_AppKey"  android:value="Your AppKey" />

        <!-- Declare required core functions of service sdk-->
        <service android:name="com.hyphenate.chat.EMChatService" />

        <!-- gcm start, replace "com.hyphenate.demoapp" with your own package -->
        <receiver
            android:name="com.hyphenate.chat.EMGCMBroadcastReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.hyphenate.chatuidemo" />
            </intent-filter>
        </receiver>

        <service android:name="com.hyphenate.chat.EMGCMListenerService"
            android:exported="false" >
        </service>
        <!-- gcm end -->
     </application>
</manifest>

In order to obtain the corresponding value of Hyphenate_AppKey, apply the APPKEY and configure it after creating the app.

App Proguard

Add the following keep into the ProGuard file:

-keep class com.hyphenate.** {*;}
-dontwarn  com.hyphenate.**

Get Device Log

For debugging purposes, you can use the following command line to obtain the log from device

adb pull /sdcard/Android/data/{package_name}/{api_key}/core_log/easemob.log

Replace the following:

  • {package_name} with your Android package name. ex. com.hyphenate.chatuidemo.
  • {api_key} is the API key of your Hyphenate app. ex. hyphenatedemo#hyphenatedeom

Next Step: Setup Google Cloud Messaging (GCM)

Updated 2 years ago

Install the Android SDK


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.