Initial setup

For CometChat SDK version 1.6

CometChat SDK v1.6 supports only Android studio for developing apps and the SDK file is cometchat-sdk.aar. To integrate the SDK in Android studio please follow the following steps:

  • Create new module from File->New module
  • Select Import .JAR or .AAR package option
  • Select the cometchat-sdk.aar file and click finish
  • Go to File->Project Structure, add module dependency cometchat-sdk
  • Add the following dependency to your build.gradle of your app and sync the Gradle

    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:support-v4:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.google.firebase:firebase-messaging:9.0.0'
    compile 'com.mcxiaoke.volley:library:1.0.17'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.clans:fab:1.6.2'
    compile 'org.jsoup:jsoup:1.8.1'
    compile 'org.apache.httpcomponents:httpcore:4.3.2'
    compile 'org.apache.httpcomponents:httpmime:4.3.3'
    compile 'com.parse.bolts:bolts-tasks:1.4.0'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.splitwise:tokenautocomplete:1.3.3'
    compile 'com.tubb.smrv:swipemenu-recyclerview:5.2.1'
    compile 'com.github.bumptech.glide:glide:3.5.2'
    compile 'se.emilsjolander:stickylistheaders:2.7.0'

    For CometChat SDK version 1.5.2 and below

    Copy the cometchat-sdk.jar into the ‘libs’ folder of your Android project.
    Right click and add it to the build path.

    use-cometchat-sdk

    External Dependencies

  • gson-2.2.4.jar
  • jsoup-1.7.3.jar
  • Volley (You can find a compiled version of Volley in our Sample App)
  • httpmime-4.1.3 onwards(for SDK 1.5.1 onwards)
  • Permissions
    Add following permissions in your AndroidManifest.xml file

    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    Not finding what you need?

    The CometChat team is here to help!