Overview (Android)

Last updated: 2020-03-12 17:03:18

PDF

IM SDK Concepts

Conversation: there are two types of conversations in the IM SDK. One is the C2C conversation, which is a one-to-one chat between users with messages read and sent within the conversation. The other is the group conversation, which is a group chat where all group members can receive messages.

Message: a message in the IM SDK is the information to be sent to the recipient. A message includes properties such as whether it was read by yourself, whether is was sent successfully, the sender’s account, and the message generation time. A message consists of several Elems, which can be text, images, emojis, and others. A message can contain multiple Elems.

Group ID: a group ID uniquely identifies a group. It is generated by the backend and returned when a group is created.

Introduction to IM SDK Objects

IM SDK objects include the communication manager, conversation, message, and group management. The following table describes them in detail.

Object Description Features
TIMManager Manager, which is responsible for basic operations of the IM SDK Initialization, login, logout, and creating conversations
TIMConversation Conversation, which is responsible for conversation-related operations Sending messages, obtaining cached conversation messages, and obtaining the unread count
TIMMessage Message Support various message types including text and image messages
TIMGroupManager Group manager Creating groups, joining groups, and quitting groups
TIMFriendshipManager Profile and relationship chain manager Obtaining and modifying profiles and relationship chains

Calling Sequence

The IM SDK call APIs in the following sequence, and other methods will be called after login succeeds.

Step
Function
Description
Initialization
TIMSdkConfig
Configure basic IM SDK settings such as SDKAppID and the log level
TIMManager : init
Initialize the IM SDK
TIMManager : setUserConfig
Configure basic user settings
TIMManager : addMessageListener
Set the message listener
Login
TIMManager : login
Log users in
Sending and receiving messages
TIMManager : getConversation
Obtain conversations
TIMConversation : sendMessage
Send messages
Group management
TIMGroupManager
Managing groups
Logout
TIMManager : logout
Log users out