Skip to main content

Send message to specified friend (SendMessage)

[Player Network SDK & MSDK] Send a message to a specified friend. If already logged in, the channel parameter can be left empty.

Supported Platforms

Supports Android, iOS, Windows platform.
note

MSDK currently does not support Windows

Function Definition

void SendMessage(GUAFriendReqInfo info,  string channel = "");

Input Parameters

ParametersTypeDescription
DescriptionFriend Request (GUAFriendReqInfo)Friend Module Request Structure
Mainly includes the request object, request information, and other important input parameters
channelstringChannel information
Such as "Facebook"

Callback Handling

The callback handling interface is GUAFriendBaseResultObserver.The callback data structure is GUABaseResult.

The callback event is FriendBaseEvents. The callback ID is GUA_FRIEND_SEND_MESSAGE.

Code Example

Refer to the enum structure GUAFriendReqType.

(1) Send Text

var reqInfo = new GUAFriendReqInfo
{
Type = GUAFriendReqType.Friend_REQ_TEXT,
Description = "INTL Service"
};
UnionAdapterAPI.GetFriendService().SendMessage(reqInfo);

(2) Send link, supports Facebook, Garena

var reqInfo = new GUAFriendReqInfo
{
Type = GUAFriendReqType.Friend_REQ_LINK,
Link = "https://www.facebook.com/link"
};
UnionAdapterAPI.GetFriendService().SendMessage(reqInfo);

(3) Send image, supports Facebook, Garena

var reqInfo = new GUAFriendReqInfo
{
Type = GUAFriendReqType.Friend_REQ_IMAGE,
ImagePath = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
};
UnionAdapterAPI.GetFriendService().SendMessage(reqInfo);

(4) Send invitation, supports Facebook, Garena, Discord

var reqInfo = new GUAFriendReqInfo
{
Type = GUAFriendReqType.Friend_REQ_INVITE,
Link = "https://www.facebook.com/link";
};
UnionAdapterAPI.GetFriendService().SendMessage(reqInfo);

(5) Send Video

var reqInfo = new GUAFriendReqInfo
{
Type = GUAFriendReqType.Friend_REQ_VIDEO,
MediaPath = "/path/to/video"
};
UnionAdapterAPI.GetFriendService().SendMessage(reqInfo);