SDK APIs (Android)

Last updated: 2021-04-23 16:40:38


    Do not use APIs of new and old versions at the same time.

    Initialization and Login APIs

    To use Tencent Cloud IM services, you need to perform initialization and log in.

    API Description
    initSDK Initializes the SDK.
    unInitSDK Uninitializes the SDK.
    login Logs in.
    logout Logs out.
    getLoginStatus Gets the login status.
    getLoginUser Gets the UserID of the current login user.

    Simple Message APIs

    Use the following message APIs if you only need to use text and signaling (a piece of custom buffer) messages.

    API Description
    addSimpleMsgListener Sets an event listener for simple messages (text messages and custom messages).
    Do not use it and addAdvancedMsgListener at the same time.
    removeSimpleMsgListener Removes the event listener for simple messages (text messages and custom messages).
    sendC2CTextMessage Sends a one-to-one (C2C) text message.
    sendC2CCustomMessage Sends a one-to-one (C2C) custom (signaling) message.
    sendGroupTextMessage Sends a group text message.
    sendGroupCustomMessage Sends a group custom (signaling) message.

    Signaling APIs

    API Description
    addSignalingListener Adds a signaling listener.
    removeSignalingListener Removes a signaling listener.
    invite Invites a user.
    inviteInGroup Invites certain users in the group.
    cancel The inviter cancels the invitation.
    accept The invitee accepts the invitation.
    reject The invitee rejects the invitation.
    getSignalingInfo Gets the signaling information.
    addInvitedSignaling Adds invitation signaling (can be used for invitation signaling triggered by group offline push messages).

    Advanced Message APIs

    If you need to send/receive rich media messages (images, videos, files, etc.) and use advanced features such as recalling messages, marking messages as read, and querying message history, use the following set of advanced message APIs. Do not use simple messages APIs and advanced message APIs at the same time.

    API Description
    addAdvancedMsgListener Sets an event listener for advanced messages.
    Do not use it and addSimpleMsgListener at the same time.
    removeAdvancedMsgListener Removes the event listener for advanced messages.
    createTextMessage Creates a text message.
    createCustomMessage Creates a custom message.
    createImageMessage Creates an image message.
    createSoundMessage Creates a voice message.
    createVideoMessage Creates a video message.
    createFileMessage Creates a file message.