insertGroupMessageToLocalStorage

Introduction

Add a message to a group chat 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 sent successfully', that is need for current user and unnecessary sending 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.
groupID String yes All The group 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> insertGroupMessageToLocalStorageRes =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .insertGroupMessageToLocalStorage(
                data: "data", 
                groupID: "groupID", 
                sender: "sender" 
                );
    if (insertGroupMessageToLocalStorageRes.code == 0) {
    }

results matching ""

    No results matching ""