Get incoming friend requests
Use the IncomingFriendRequests
property to retrieve the current user’s incoming friend requests list. The following code snippet shows the usage of the IncomingFriendRequests
property.
/// <summary>
/// The list of the user's incoming friend requests.
/// </summary>
IList<Relationship> IncomingFriendRequests { get; }
The following code snippet shows how to get the incoming friend requests for the current user.
// Initialize the Friends service
await FriendsService.Instance.InitializeAsync();
IReadOnlyList<Relationship> incomingFriendRequests = FriendsService.Instance.IncomingFriendRequests;
Debug.Log("Incoming Friend Requests: " + incomingFriendRequests.Count);
foreach (var request in incomingFriendRequests)
{
Debug.Log("User ID: " + request.Member.Id);
}