createLocationMessage

Introduction

Create a location message.

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

For details, you can referring to this document.

Parameter details

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

Returned template

V2TimValueCallback<V2TimMsgCreateInfoResult>

{
    code: number,
    desc: string,
    data: {
        id: string,
        messageInfo: V2TimMessage,
    }
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.
data V2TimMsgCreateInfoResult The location message created.

Code example

import { TencentImSDKPlugin } from 'react-native-tim-js';


const createLocationMessage = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .createLocationMessage(
        '深圳市南山区深南大道',
        34,
        20
    );
if (createLocationMessage.code === 0) {
    const id = createLocationMessage.data?.id;




    const sendMessageRes = await TencentImSDKPlugin.v2TIMManager
        .getMessageManager()
        .sendMessage({ id: id!, receiver: 'userID', groupID: 'groupID' });
    if (sendMessageRes.code === 0) {

    }
}

results matching ""

    No results matching ""