iOS & Android Mobile Chat SDK


“The secret of getting ahead is getting started!” – Mark Twain

At CometChat, we always believe in keeping you ahead. Here’s the next step to it – introducing Mobile Chat SDK. The easiest way to add chat to your existing app.

CometChat-Mobile-SDK

CometChat Mobile SDK

The CometChat Mobile SDK is a set of functions that lets you integrate CometChat within your existing app. The simple API has an intuitive flow which makes the entire process hassle-free. All you need to do is add the CometChat SDK to your app and in no time you will be able to send/receive messages in your existing mobile application.

CometChat SDK is best used when you already have an existing mobile app. For example, if you have a dating website & app and want to add chat functionality across your website and existing app, then CometChat (any Edition) along with our Mobile SDK will be the right solution for you. Your users will be able to chat on your website as well as your app seamlessly.

Benefits of CometChat Mobile SDK

1. Easy API
The Easy API facilitates sharing of data efficiently. You will be able to easily add chat to your existing iOS & Android application.

2. Cross Platform Communication (Web, Mobile, Desktop)
The CometChat SDK seamlessly integrates with your existing app as well as your website. So your users can chat on your website, desktop or mobile app and they will all be connected with each other.

3. No External Dependency
The SDK is a standalone package and does not require you to include/reference any other library. It will work out of the box.

4. Sample Chat Apps with Source Code
On purchase you will receive the SDK as well as full source code of a sample mobile chat app.

Implementation at a Glance

1. Login
For example, if you want to login the user with ID 5 to your site which has the URL “http://www.yoursite.com/cometchat”, then the code will be:

cometchat.login("http://www.yoursite.com/cometchat", 5, new Callbacks() {
    @Override
    public void successCallback(JSONObject success) {}
    @Override
    public void failCallback(JSONObject fail) {}
});
Success Response:
{"message": "Login successful"}

2. sendMessage
If you want to send message “Hello” to the user with ID 7, then the code will be:

cometchat.sendMessage(“7”, “Hello”, new Callbacks() {
    @Override
    public void successCallback(JSONObject response) {}
    @Override
    public void failCallback(JSONObject response) {}
});

3. Subscribe
Now simply subscribe to start receiving messages, user list and profile updates from CometChat. Set mode flag to true to allow stripping of HTML content.

cometchat.subscribe(true, new SubscribeOneOnOneCallbacks() {
    @Override
    public void onMessageReceived(JSONObject receivedMessage, int messageType) {}
    @Override
    public void gotProfileInfo(JSONObject profileInfo) {}
    @Override
    public void gotOnlineList(JSONObject onlineUsers) {}
    @Override
    public void onError(JSONObject errorResponse) {}
});

Are You a Developer?

For the Android guide, please refer: Android Chat SDK
For the iOS guide, please refer: iOS Chat SDK

Get The CometChat Mobile SDK for iOS & Android

Purchase the Mobile SDK or contact us if you have any questions. You will also need any CometChat Edition of your choice (e.g. CometChat Premium Edition) depending on the features you would like on your website.

You may also like to read