createLocationMessage

Introduction

Create a location message.

The location message will carry the longitude, latitude and a description of the location.

You can take advantage of the official location message extension provided by us, including location picker and location shows, tim_ui_kit_lbs_plugin, to add the location functionality quickly.

For details, you can referring to this document.

Parameter details

Parameter name Parameter type Required Platform Description
desc String yes All The description of the location.
longitude double yes All longitude
latitude double no All latitude

Returned template

V2TimValueCallback<V2TimMsgCreateInfoResult>

{
    code: int,
    desc: String,
    data: {
        id: String,
        messageInfo: V2TimMessage,
    }
}

Return value details

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

Code example

    V2TimValueCallback<V2TimMsgCreateInfoResult> createLocationMessage =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .createLocationMessage(
              desc: "Tencent Binhai Building", 
              longitude: 34, 
              latitude: 20, 
            );
    if (createLocationMessage.code == 0) {
      String? id = createLocationMessage.data?.id;
      V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
          .v2TIMManager
          .getMessageManager()
          .sendMessage(id: id!, receiver: "userID", groupID: "groupID");
      if (sendMessageRes.code == 0) {
      }
    }

results matching ""

    No results matching ""