tencent cloud


Legacy SDK APIs (Android)

Last updated: 2021-01-06 15:13:02


    As a core component of the IM SDK, TIMManager works for the initialization, login, conversation creation, and push management of the IM SDK.

    • Initialization: is the prerequisite for using the IM SDK. You need to call the init API before calling other APIs.
    • Login: you need to configure SDKAppID, UserID, and UserSig before using IM.
    • Conversation: each time you start a conversation, you open a conversation window. A conversation can be a C2C chat or a group chat.
    • Push: you can configure and manage features related to offline push, including tokens and feature enabling and disabling.

    Initialization APIs

    API Description
    getInstance Obtains the instance of TIMManager.
    init Initializes the SDK and specifies the global configuration.
    unInit Uninitializes the SDK.
    getSdkConfig Obtains the global configuration.
    setUserConfig Specifies user configurations.
    getUserConfig Obtains user configurations.
    addMessageListener Adds a message receiving listener.
    removeMessageListener Removes a message receiving listener.
    isInited Checks whether the SDK is initialized.

    Login APIs

    API Description
    login Logs in.
    autoLogin Enables auto-login.
    logout Logs out.
    getLoginUser Obtains the logged-in user.
    getLoginStatus Obtains the current login status.

    Conversation management APIs

    API Description
    getConversationList Obtains the list of conversations.
    getConversation Obtains a conversation.
    deleteConversation Deletes a conversation.
    deleteConversationAndLocalMsgs Deletes a conversation and its messages.

    APIs for configuring offline push

    API Description
    setOfflinePushToken Configures the client token and the certificate busiID.
    setOfflinePushSettings Initializes the offline push configuration. Use this API after you have logged in to ensure that the configuration takes effect.
    getOfflinePushSettings Obtains the offline push configuration. Use this API after you have logged in.
    setOfflinePushListener Configures the message notification listener that works when the app is running at the backend. (This API has been deprecated.)
    doBackground Reports that the app is running at the backend.
    doForeground Reports that the app is running at the frontend.

    APIs for querying local conversations and messages without login

    API Description
    initStorage Loads the local storage without login.

    Debugging APIs

    API Description
    getVersion Obtains the version number.
    addMessageUpdateListener Adds a message update listener to obtain message updates.
    removeMessageUpdateListener Deletes a message update listener.
    getNetworkStatus Obtains the network connection status.
    getServerTimeDiff Obtains the time difference in the unit of seconds between the server and local device. Time difference = svrTime – localTime.


    Each time you start a conversation, you open a conversation window. A conversation can be a C2C chat or a group chat.
    All API functions provided by TIMConversation are related to message operations, including sending messages, obtaining the message history, setting read receipts, recalling messages, and deleting messages.

    APIs for sending messages

    API Description
    sendMessage Sends a message.
    sendOnlineMessage Sends an online message. (Incognito)

    APIs for obtaining messages

    API Description
    getMessage Pulls the message history from the cloud.
    getLocalMessage Obtains the message history from the local database.
    getLastMsg Obtains the last message of the current conversion.

    APIs for marking messages as read

    API Description
    setReadMessage Marks a message as read.
    getUnreadMessageNum Obtains the number of unread messages.

    APIs for recalling and deleting messages

    API Description
    revokeMessage Recalls a sent message.
    deleteLocalMessage Deletes the local message history of the current conversation.

    APIs for obtaining conversation information

    API Description
    getType Obtains the conversation type.
    getPeer Obtains the conversation ID.
    getGroupName Obtains the group name.

    Drafts APIs

    API Description
    setDraft Adds an unfinished message as a draft.
    getDraft Obtains a draft.
    hasDraft Checks whether the current conversation has a draft.

    APIs for importing messages to a conversation

    API Description
    saveMessage Adds a message to the list of local messages without sending it.
    importMsg Imports a message to the local database.
    findMessages Searches for a message by using the given message locator.


    The group management component is used to create groups, delete groups, invite or delete group members, and modify group or member profiles.

    API for obtaining a group instance

    API Description
    getInstance Obtains the instance of TIMGroupManager.

    APIs for creating, disbanding, joining, and quitting groups

    API Description
    createGroup Creates a group.
    deleteGroup Disbands a group.
    applyJoinGroup Applies for joining a group.
    quitGroup Quits a group.

    APIs for inviting and deleting group members

    API Description
    inviteGroupMember Invites a friend to a group.
    deleteGroupMember Deletes a group member.

    APIs for obtaining group information

    API Description
    getGroupList Obtains the list of groups.
    getGroupInfo Obtains group information from the server.
    queryGroupInfo Obtains group information from the local storage.
    getGroupMembers Obtains the list of group members.
    getSelfInfo Obtains your profile in the group.
    getGroupMembersInfo Obtains the profiles of specific members.
    getGroupMembersByFilter Obtains a list of group members of a specific type (which can be filtered by field and displayed in pagination mode).

    APIs for modifying group information

    API Description
    modifyGroupInfo Modifies group information.
    modifyGroupOwner Transfers the group ownership.

    API for modifying group member profiles

    API Description
    modifyMemberInfo Modifies a group member's profile.

    APIs for handling pending group requests

    API Description
    getGroupPendencyList Obtains the list of pending group requests.
    reportGroupPendency Reports that pending group requests have been read.


    TIMFriendshipManager is the component for managing profile relationship chains. You can use it to add friends, delete friends, obtain friend information, and modify friend profiles.

    API Description
    getInstance Obtains the instance of TIMFriendshipManager.
    init Initializes TIMFriendshipManager.
    getUsersProfile Obtains profiles of specific users.
    getSelfProfile Obtains your personal profile.
    querySelfProfile Obtains your personal local profile. If there is no available data, null is returned.
    queryUserProfile Obtains a local user profile. If there is no available data, null is returned.
    modifySelfProfile Modifies your personal profile.
    getFriendList Obtains the list of friends.
    queryFriendList Obtains the relationship chain list in the cache. The cached data source is the return result of the previous call of getFriendList. Ensure that getFriendList has been called.
    queryFriend Queries the relationship chain of a friend in the cache. The cached data source is the return result of the previous call of getFriendList. Ensure that getFriendList has been called.
    addFriend Adds a friend.
    deleteFriends Deletes a friend.
    modifyFriend Modifies a friend profile.
    doResponse Processes a friend request.
    createFriendGroup Creates a friend group.
    getFriendGroups Obtains specific friend groups. If groupNames is set to null, all friend groups will be returned.
    deleteFriendGroup Deletes a friend group.
    renameFriendGroup Renames a friend group.
    addFriendsToFriendGroup Adds friends to a friend group.
    deleteFriendsFromFriendGroup Deletes specific friends from a friend group.
    getPendencyList Obtains the list of pending requests.
    deletePendency Deletes a pending request.
    pendencyReport Reports that pending requests have been read.
    getBlackList Obtains the blacklist.
    addBlackList Adds a user to the blacklist.
    deleteBlackList Deletes a specific user from the blacklist.
    checkFriends Checks the friendship with a specific user.


    TIMMessage consists of multiple message elements (TIMElem). The TIMElem can be text or an image, and each message can contain multiple texts or images. For more information, see Receiving and Sending Messages.

    API Description
    addElement Adds a message element.
    getElement Obtains the message element of the corresponding index.
    getElementCount Obtains the number of message elements.
    status Queries the message status.
    isSelf Checks whether you are the message sender.
    getSender Queries the message sender.
    getSenderNickname Queries the nickname of the message sender.
    getSenderFaceUrl Queries the profile photo URL of the message sender.
    getMsgId Obtains the message ID.
    getMsgUniqueId Obtains the uniqueId of the message.
    timestamp Obtains the message timestamp.
    isRead Checks whether you have read the message.
    isPeerReaded Checks whether the message receiver has read the message. This API is applicable to C2C conversations only.
    getMessageLocator Obtains the message locator.
    checkEquals Checks whether the message is the one specified by the locator.
    remove Deletes a message.
    getConversation Obtains a conversation.
    getSenderProfile Obtains the sender profile.
    getSenderGroupMemberProfile Obtains the sender profile in the group.
    setPriority Configures message priority (for group messages only).
    getPriority Obtains message priority (for group messages only).
    setOfflinePushSettings Configures parameters related to offline push.
    getOfflinePushSettings Obtains the offline push configuration of messages.
    setCustomInt Configures the custom integer. The default value is 0. This attribute is for local use only.
    getCustomInt Obtains the custom integer.
    setCustomStr Configures custom content. The default value is the empty string "". This attribute is for local use only.
    getCustomStr Obtains the value of the custom content.
    copyFrom Copies message content to the current message, including Elem, priority, online, and offlinePushInfo.
    convertToImportedMsg Imports the message to the local storage.
    setTimestamp Configures the message timestamp.
    setSender Configures the sender ID.
    getRecvFlag Obtains the notification type of the message.
    getRand Obtains the random code of the message.
    getSeq Obtains the sequence number of the message.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support