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
- Unity
- Unreal Engine
Android, iOS, Windows
platform.Android, iOS, Windows
platform.MSDK currently does not support Windows.
Function Definition
- Unity
- Unreal Engine
void SendMessage(GUAFriendReqInfo info, string channel = "");
static void SendMessage(const GUAFriendReqInfo &req_info, const std::string &channel = "");
Input Parameters
- Unity
- Unreal Engine
Parameter | Type | Description |
---|---|---|
info | GUAFriendReqInfo | Friend module request body Including the request object, request information, and other important parameters. |
channel | string | Channel definition Example: "Facebook" |
Parameter | Type | Description |
---|---|---|
Info | GUAFriendReqInfo | Friend module request body Including the request object, request information, and other important parameters. |
Channel | std::string | Channel definition Example: "Facebook" |
Callback Processing
The callback processing API is GUAFriendBaseResultObserver. The callback data structure is GUABaseResult.
- Unity
- Unreal Engine
The callback event is FriendBaseEvents.
The callback methodID is GUA_FRIEND_SEND_MESSAGE
.
The callback event is OnBaseResultNotify.
The callback methodID is kMethodIDFriendSendMessage
.
Code Sample
See enumeration structure GUAFriendReqType.
- Unity
- Unreal Engine
(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);
(1) Send text
GUAFriendReqInfo reqInfo;
reqInfo.type = (int32)GUAFriendReqType::kReqText;
reqInfo.description = "INTL Service";
GUA_NAMESPACE::GUAFriendService::SendMessage(reqInfo);
(2) Send links, supports Facebook, Garena
GUAFriendReqInfo reqInfo;
reqInfo.type = (int32)GUAFriendReqType::kReqLink;
reqInfo.link = "https://www.facebook.com/link";
GUA_NAMESPACE::GUAFriendService::SendMessage(reqInfo);
(3) Send pictures, supports Facebook and Garena
GUAFriendReqInfo reqInfo;
reqInfo.type = (int32)GUAFriendReqType::kReqImage;
reqInfo.image_path = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
GUA_NAMESPACE::GUAFriendService::SendMessage(reqInfo);
(4) Send invitations, supports Facebook, Garena, Discord
GUAFriendReqInfo reqInfo;
reqInfo.type = (int32)GUAFriendReqType::kReqInvite;
reqInfo.Link = "https://www.facebook.com/link";
GUA_NAMESPACE::GUAFriendService::SendMessage(reqInfo);
(5) Send videos
GUAFriendReqInfo reqInfo;
reqInfo.type = (int32)GUAFriendReqType::kReqVideo;
reqInfo.media = "/path/to/video";
GUA_NAMESPACE::GUAFriendService::SendMessage(reqInfo);