AddFriend [MSDK Only]
[MSDK Only] Players can directly add their game friends as their QQ friends as games can directly open mobile QQ. Multiple clicks will not send multiple QQ requests. Currently only supports QQ.
Supported Platform
- Unity
- Unreal Engine
Supports
Android, iOS
platform.Supports
Android, iOS
platform.Function Definition
- Unity
- Unreal Engine
void AddFriend(GUAFriendReqInfo info, string channel = "");
static void AddFriend(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 For example, QQ. |
Parameter | Type | Description |
---|---|---|
info | GUAFriendReqInfo | Friend module request body Including the request object, request information, and other important parameters. |
channel | string | Channel For example, QQ. |
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_ADD_FRIEND
.
The callback event is OnBaseResultNotify.
The callback methodID is kMethodIDFriendAddFriend
.
Code Sample
- Unity
- Unreal Engine
var reqInfo = new GUAFriendReqInfo
{
Title = "title", // Optional when adding friends, indicates a remark
Desc = "desc", //Optional when adding friends, indicates the verification information
Type = GUAFriendReqType.Friend_REQ_TEXT, // Optional when adding friends
User = "friendOpenId", // Mandatory when adding friend, friend's OpenID
};
UnionAdapterAPI.GetFriendService().AddFriend(reqInfo, "QQ");
GUAFriendReqInfo info;
info.title = "title"; // Optional when adding friends, indicates a remark
info.desc = "desc"; // Optional when adding friends, indicates the verification information
info.type = kGUAFriendReqTypeText; // Optional when adding friends
info.user = "friendOpenId"; //Mandatory when adding friend, friend's OpenID
GUA_NAMESPACE::GUAFriendService::AddFriend(info, "QQ");