QueryFriends
[Player Network SDK & MSDK] Obtains the channel friend list or the in-game friend list of the player.
info
- Currently, the client only supports friends list enquiries for Epic. Other channels need to be done with backend API.
- [Player Network SDK Only] Facebook channel can obtain the friends list with API: Facebook Friends.
Supported Platform
- 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
| Parameter | Type | Description |
|---|---|---|
| page | int | The specified page of a friend to pull |
| count | int | The number of friends per page |
| isInGame | bool | Whether the friend is an in-game friend. true: In-game friend false: Not in-game friend |
| channel | string | Channel definition Example: "Facebook" QQ Mobile and WeChat currently only provide backend APIs. This is to prevent unauthorized access to the relationship chain. |
| subChannel | string | Sub channel |
| extraJson | string | The extended field to pass additional data |
| Parameter | Type | Description |
|---|---|---|
| page | int32 | The specified page of a friend to pull |
| count | int32 | The number of friends per page |
| is_in_game | bool | Whether the friend is an in-game friend. true: In-game friend false: Not in-game friend |
| channel | std::string | Channel definition Example: "Facebook" QQ Mobile and WeChat currently only provide backend APIs. This is to prevent unauthorized access to the relationship chain. |
| sub_channel | std::string | Sub channel |
| extra_json | std::string | The extended field to pass additional data |
Callback Processing
The callback processing API is GUAQuereyFriendObserver. The callback data structure is GUAFriendResult.
- Unity
- Unreal Engine
The callback event is QuereyFriendEvents.
The callback methodID is GUA_FRIEND_QUERY_FRIENDS.
The callback event is OnQueryFriendNotify.
The callback methodID is kMethodIDFriendQueryFriends.
Code Sample
- Unity
- Unreal Engine
UnionAdapterAPI.GetFriendService().QueryFriends();
GUA_NAMESPACE::GUAFriendService::QueryFriends();