Skip to main content

SendMessage

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

Supported Platform

Supports Android, iOS, Windows platform.
note

MSDK currently does not support Windows.

Function Definition

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

Input Parameters

ParameterTypeDescription
infoGUAFriendReqInfoFriend module request body
Including the request object, request information, and other important parameters.
channelstringChannel definition
Example: "Facebook"

Callback Processing

The callback processing API is GUAFriendBaseResultObserver. The callback data structure is GUABaseResult.

The callback event is FriendBaseEvents. The callback methodID is GUA_FRIEND_SEND_MESSAGE.

Code Sample

See enumeration structure GUAFriendReqType.

(1) Send text

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

(2) Send links, supports Facebook, Garena

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

(3) Send pictures, supports Facebook and 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 invitations, 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 videos

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