insertC2CMessageToLocalStorage

Introduction

Add a message to a c2c conversation locally.

Only supports adding a text message, while the data is text itself.

This method is mainly used for add some tips or reminds to history message list, like 'Message send successfully', that is need for current user and unnecessary to sent to other users.

The messages sent by this method will only stored locally, and lost after re-installing.

Do not works on Web.

Parameter details

Parameter name Parameter type Required Platform Description
data String yes All The message content.
userID String yes All The target user ID.
sender String yes All The sender user ID.

Returned template

V2TimValueCallback<V2TimMessage>

{
    code : int
    desc : String
    data : {
      cloudCustomData : String
      customElem : V2TimCustomElem
      elemType : int
      faceElem : V2TimFaceElem
      faceUrl : String
      fileElem : V2TimFileElem
      friendRemark : String
      groupAtUserList : List<String>
      groupID : String
      groupTipsElem : V2TimGroupTipsElem
      id : String
      imageElem : V2TimImageElem
      isExcludedFromLastMessage : bool
      isExcludedFromUnreadCount : bool
      isPeerRead : bool
      isRead : bool
      isSelf : bool
      localCustomData : String
      localCustomInt : int
      locationElem : V2TimLocationElem
      mergerElem : V2TimMergerElem
      messageFromWeb : String
      msgID : String
      nameCard : String
      needReadReceipt : bool
      nickName : String
      offlinePushInfo : V2TimOfflinePushInfo
      priority : int
      progress : int
      random : int
      sender : String
      seq : String
      soundElem : V2TimSoundElem
      status : int
      textElem : V2TimTextElem
      timestamp : int
      userID : String
      videoElem : V2TimVideoElem
    }
}

Return value details

name type description
code int Request result: Error codes. 0 means success.
desc String The description of the failure.
data V2TimMessage The message inserted.

Code example

    V2TimValueCallback<V2TimMessage> insertC2CMessageToLocalStorageRes =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .insertC2CMessageToLocalStorage(
                data: "data", 
                userID: "userID", 
                sender: "sender" 
                );
    if (insertC2CMessageToLocalStorageRes.code == 0) {
    }

results matching ""

    No results matching ""