Query Channel Friend List (QueryFriends)
[Player Network SDK & MSDK] Get the list of channel friends or in-game friends for a player.
info
- Currently, the client only supports fetching friends from the Epic channel. Other channels require obtaining the list via the backend.
- [Player Network SDK only] Facebook channel friends can be obtained via a backend interface for third-party channel co-playing friends list: Facebook Friends
Supported Platforms
- Unity
- Unreal Engine
Supports
Android, iOS, Windows platform.Supports
Android, iOS, Windows platform.note
MSDK currently does not support Windows
Function Definition
- Unity
- Unreal Engine
void QueryFriends(int page = 0, int count = 0, bool isInGame = true, string channel = "", string subChannel = "", string extraJson = "{}");
static void QueryFriends(
int page = 0,
int count = 0,
bool is_in_game = true,
const std::string &channel = "",
const std::string &sub_channel = "",
const std::string &extra_json = "{}");
Input Parameters
- Unity
- Unreal Engine
| Parameters | Type | Description |
|---|---|---|
| page | int | Which page of friends to fetch |
| count | int | Number of friends per page |
| isInGame | bool | Whether They Are In-Game Friends true indicates an in-game friend; false indicates otherwise |
| channel | string | Channel definition Example: "Facebook" QQ and WeChat currently only offer backend API.This is to prevent unauthorized access to the relationship chain. |
| subChannel | string | Sub-channel |
| extraJson | string | Extended interface, passing data transparently |
| Parameters | Type | Description |
|---|---|---|
| page | int32 | Which page of friends to fetch |
| count | int32 | Number of friends per page |
| is_in_game | bool | Whether They Are In-Game Friends true indicates an in-game friend; false indicates otherwise |
| channel | std::string | Channel definition Example: "Facebook" QQ and WeChat currently only offer backend API.This is to prevent unauthorized access to the relationship chain. |
| sub_channel | std::string | Sub-channel |
| extra_json | std::string | Extended interface, passing data transparently |
Callback Handling
The callback handling interface is GUAQuereyFriendObserver.The callback data structure is GUAFriendResult.
- Unity
- Unreal Engine
The callback event is QuereyFriendEvents. The callback ID is GUA_FRIEND_QUERY_FRIENDS.
The callback event is OnQueryFriendNotify. The callback ID is kMethodIDFriendQueryFriends.
Code Example
- Unity
- Unreal Engine
UnionAdapterAPI.GetFriendService().QueryFriends();
GUA_NAMESPACE::GUAFriendService::QueryFriends();