Skip to content

Working with Activity Likes

Like Post

To like or dislike activity post or comment, do next:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
bool setLiked = true;
GetSocial.LikeActivity (activityId, setLiked, 
    post => {
        Debug.Log("Activity was successfully liked");
        // You can check if activity is liked by calling
        // bool isLiked = post.IsLikedByMe;
    }, 
    error => {
        Debug.LogWarning("Failed to like an activity, error: " + error.Message);
    });

If you want to unlike activity, pass false as parameter setLiked.

We handle data consistency, so if you’re trying to like already liked activity, or dislike not liked activity, operation will call successful callback without any changes.

GetSocial UI

Activity is liked/unliked when user presses Like button.

List of Post Likes

To get a list of users, who liked an activity:

1
2
3
4
5
6
7
8
GetSocial.GetActivityLikers (activityId, offset, limit,
    users => {
        Debug.Log("Successfully retrieved a list of activity likers!");
        showUsersList(users);
    }, 
    error => {
        Debug.LogWarning("Failed to get a list of activity likers, error: " + error.Message);
    });

Where offset and limit is pagination parameters, for example, to get first 50 users, who liked a post, use offset=0 and limit=50, to get next page - offset=50, limit=50 etc.

GetSocial UI

Likers list is displayed after user pressed on likes count:


GetSocial Activity Likes View

Give us your feedback! Was this article helpful?

😀 🙁