DEV Community

Cover image for Applozic Android SDK Tutorial 3 - Chat Conversations
Anurag Jayaraman for Applozic Inc

Posted on • Originally published at applozic.com

Applozic Android SDK Tutorial 3 - Chat Conversations

Introduction

This tutorial is Part 3 of a multi-part series covering Applozic Android SDK integration into an Android app.

Our goal is to learn the following steps in this tutorial:

  1. Launch Conversation list screen
  2. Create individual chat thread
  3. Create group chat thread
  4. Create context based chat thread
  5. Delete chat threads

You can download the sample Android chat app from Applozic GitHub.

Conversation screen

To give you an idea of what the conversation screen would look like in the final app, take a look at the screenshot below.

conversation screen
Android Conversation screen

To get started with such a conversation screen, add the following code:

Intent intent = new Intent(this, ConversationActivity.class);            
startActivity(intent);

You can set this to activate as soon as the user opens the conversation screen.

Individual Chat

From the main conversation screen, the user can choose to launch either an individual conversation thread or a group chat thread.

An individual chat screen will look like this:

Individual chat screen
Individual chat screen

For starting individual conversation thread, set "userId" in intent:

Intent intent = new Intent(this, ConversationActivity.class);            
intent.putExtra(ConversationUIService.USER_ID, "receiveruserid123");   
intent.putExtra(ConversationUIService.DISPLAY_NAME, "Receiver display name"); 
//to display the title.
intent.putExtra(ConversationUIService.TAKE_ORDER,true); 
//Skip chat list on back press 
startActivity(intent);

Group Chat

A group conversation contains multiple users that can send and receive messages. Internally, a group conversation is referred to as a channel.

Applozic supports multiple group types that serve different purposes.

Value Name Description
1 Private Group Private groups are not accessible to contacts other than the ones present in the group. Only group admin can add/remove members in the group. You can create private groups to facilitate close, WhatsApp style interactions. For example, doctor-patient chats.
2 Public Group Users will be able to search and join Public groups. Any group member can add/remove members in this group. For example, Public groups can be used to create area-wise communities in a social app where users can search their area's community and join.
5 Broadcast Group A message can be sent to several contacts at once. Messages sent in the broadcast group are received by the members of the group as one-to-one chat thread. Only the sender can see the broadcast group. The broadcast group works on a similar behavior as that of WhatsApp broadcasts.
6 Open Group Used for free-flowing chats such as live streaming chats, live event chats etc. You need not add any members to this group. All users present on the chat screen will receive messages via MQTT (publish/subscribe pattern). Push notifications are not supported in Open groups.
7 GroupOfTwo Used for the purpose where dealers are selling products and any particular user wants to chat about multiple products with the same dealer. At that time, it is required to show two different chat threads in the conversation history as the context (product) of the chats is different.
9 Contacts Group Used for creating Friends/Favorites contact List. These lists can be maintained on the application level and any member of the group can access it. For example, an event management company can use the lists to maintain attendees of an event at one place.
10 Support Group Best suited for people who want to use Applozic's sister product, Kommunicate. These groups are specifically built for the purpose of customer support chat and may contain multiple team members and chatbots talking to a user.
Table showcasing different group types

Continue this Tutorial on Applozic Blog!

We have the detailed tutorial with code snippets available on our blog for you to continue with your integration!

Click here to learn how to:

  • Create a group chat thread
  • Create a context based chat thread
  • Delete chat threads

Top comments (0)