SDKsReact Native
Create location message
Construct a location message with geographical coordinates and descriptions using the OpenIM React Native SDK.
Construct a location message specifying geographical coordinates and an address description:
const message = await OpenIMSDK.createLocationMessage({
description: 'Pudong New Area, Shanghai',
longitude: 121.4737,
latitude: 31.2304,
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
description | string | Yes | Location name or street address description. |
longitude | number | Yes | Geographical longitude value. |
latitude | number | Yes | Geographical latitude value. |
Return value
A resolved Promise returns the initialized MessageItem object with location coordinates stored in locationElem.
This method builds the message structure strictly in client memory; it does not dispatch messages to the server or trigger lifecycle events. After initialization, invoke Send message to deliver it to a one-to-one or group conversation.
Was this page helpful?