Add Friend (AddFriend) [MSDK only]
[MSDK Only] Players can directly add (invoke QQ) other game players as QQ friends in-game. (Multiple clicks will not send multiple QQ friend requests).Currently only QQ supports this feature.
Supported platforms
- 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
| Parameters | Type | Description |
|---|---|---|
| Description | Friend request (GUAFriendReqInfo) | Friend Module Request Structure Mainly includes the request object, request information, and other important input parameters |
| channel | string | Channel information For example, "QQ" |
| Parameters | Type | Description |
|---|---|---|
| Description | Friend request (GUAFriendReqInfo) | Friend Module Request Structure Mainly includes the request object, request information, and other important input parameters |
| channel | string | Channel information For example, "QQ" |
Callback Handling
The callback handling interface is GUAFriendBaseResultObserver.The callback data structure is GUABaseResult.
- Unity
- Unreal Engine
The callback event is FriendBaseEvents. The callback ID is GUA_FRIEND_ADD_FRIEND.
The callback event is OnBaseResultNotify. The callback ID is kMethodIDFriendAddFriend.
Code Example
- Unity
- Unreal Engine
var reqInfo = new GUAFriendReqInfo
{
Title = "title", // Optional when adding a friend, indicates notes
Desc = "desc", // Optional when adding a friend, indicates verification information
Type = GUAFriendReqType.Friend_REQ_TEXT, // Optional when adding a friend
User = "friendOpenId", // Required when adding a friend, the friend openid
};
UnionAdapterAPI.GetFriendService().AddFriend(reqInfo, "QQ");
GUAFriendReqInfo info;
info.title = "title"; // Optional when adding a friend, indicates notes
info.desc = "desc"; // Optional when adding a friend, indicates verification information
info.type = kGUAFriendReqTypeText; // Optional when adding a friend
info.user = "friendOpenId"; // Required when adding a friend, the friend openid
GUA_NAMESPACE::GUAFriendService::AddFriend(info, "QQ");