Follow / Unfollow
Following relationships are a fundamental part of social networks. This creates a relationship between users in Social features.
the connection between users will be used to determine the visibility and the accessibility of data in User Feed and Global feed data.
User relationship concept
In the current state, our SDK provides a one-direction relationship. For example, when user A has followed User B, in this case, the system will know that user A has connected to user B.
User Connection method concept
In the current state, our SDK provides 2 ways for users to create relationships with other users, this connection method will be applied to every user in the network.
1. With request process
Once a user sends the Follow action to the target userId
, the system will send the request to the target user. Until the target user accepts the follow request, the connection will not yet be established.
2. Without Request process
Once a user sends the Follow action to the target userId
, the system will automatically establish the connection between 2 users.
By default, the connection method is With request process.
If you wish to change the connection method, you can contact our support team to choose between 1 of these 2 options.
Get follow status and connection counter
The first step to start following other users is to know the connection status of the target user. You can follow this line of code.
For self
For other user
Our SDK does provide 3 status
1.Accept
: this status means the target user has already connected to the SDK method caller.
2.Pending
: this status means the target user has already received the follow request from the SDK method caller. This status will only available when the connection method setting is With request process
3.None
: this status means the target user has not connected to the SDK caller.
With this method, you can also receive the total count of:
1.Following counter : this is the total number of users who the target user has follow.
2.Follower counter : this is the total number of users who followed the target user.
3.Pending counter : this is the total number of follow request the target user has received
Follow other user
To start following other users, our SDK has been designed to be easy to use. You can simply pass the userId
who you want to follow and we will do the rest. please try the following code.
Withdraw your follow request
In case that you want to withdraw your request. You can follow this code.
Get Follower user list
To see the Follower user list, you can follow this code.
For Self
For Other user
We currently do not support sorting of the follower user list.
Get Following user list
To see the Following user list, you can try this code.
For self
For other user
We currently do not support sorting of the following user list.
Get Follower request list
To see the Following request list, you can try this code.
We currently do not support sorting of the following request user list.
Accept follower request
To accept the follower request, you can try this code.
Note if the Follower request is no longer available (either the follower request sender has withdrawn the request or the request has been accepted or declined before.) SDK will return the error message.
Decline follower request
To decline the follower request, you can try this code.
If the Follower request is no longer available (either the follower request sender has withdrawn the request or the request has been accepted or declined before), SDK will return the error message.
Implement follow pagination
Whether you're querying a following or followers list, a maximum of 15 items in each page will be returned. Pagination in Android uses the Paging3
library. It will automatically handle the loading of the next page when the user scrolls the list based on PagingSource
logic.
Getting Realtime Updates
SDK supports real time events to reflect changes related to current user’s follower/following list. For example, when a user removes a follower in the follower list, it can be reflected automatically in another user's device. Refer to the Follow topic in Realtime events for the implementation details.
Last updated