The friend system allows your users to find each other and set up social connections. The SDK supports the following functionality:
- search by nickname
- get the list of friends from social networks
- manage the friend list, send invitations, add and remove friends, block users, etc.
- manage personal data via the user account
To implement the friend system, you should have the user account functionality in your application. Methods of working with this system use the following parameters from the user account:
- user ID
Users should specify the nickname to ensure the friend system works correctly. Implement the following nickname specification logics:
- Use the name that was used for registration via login and password as a nickname.
- Implement the nickname request during social authentication or platform accounts.
The Login library has the following methods of working with the friend system:
XLogin.getCurrentUserFriends— updates the locally cached user friends data.
XLogin.updateCurrentUserFriend— updates the status of the user’s social connections. The social connections status is affected by the following actions:
- send or cancel a friend request
- accept or decline a friend request
- delete the user from the friend list
- block or unblock the user
XLogin.getSocialFriends— updates the locally cached data of user’s friends from a social network.
XLogin.getUserPublicInfo— gets data from the user’s public profile.
XLogin.searchUsersByNickname— searches for the user by nickname.
XLogin.startSocialAccountLinking— generates an intent to open a social network authorization window to link an account to a user account.
UpdateLinkedSocialNetworks— gets the user’s social networks data.
Implementing a friends system for social networks
To let users interact with friends from social networks in your application, configure the storage of friend data on the Xsolla side:
- Go to your Publisher Account.
- Click Open in the Login block and go to Login projects.
- Click Open and set up in the Login project block.
- Go to General settings > Authentication.
- Set the Store friends from social networks toggle to On.
- Save changes.
To make friends from the social network available to the player in the application, implement the following logic in your application:
- Link a social network to a player’s account using the
startActivityForResult( XLogin.createSocialAccountLinkingIntent(context, socialNetwork), RC_LINKING )
- Update your friends list using the
- Get a list of friends from a linked social network using the
Was this article helpful?
Rate this page
Don’t want to answer
Thank you for your feedback!
Found a typo or other text error? Select the text and press Ctrl+Enter.