Skip to main content

Like Post

The LikeMinds Android Feed SDK incorporates a "like" feature that enables users to express their appreciation for posts by other members. With just a simple tap, users can indicate their interest and support for specific content on their feed.

Steps to like a post

  1. Create a LikePostRequest object using LikePostRequest.Builder class by passing all the required parameters.
  2. Call likePost() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<Nothing>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of LikePostRequest
val likePostRequest = LikePostRequest.Builder()
.postId("ENTER POST ID") // id of the post liked
.build()
// get response (LMResponse<Nothing>)
val response = LMFeedClient.getInstance().likePost(likePostRequest)
if (response.success) {
// your function to process post liked action
processPostLiked()
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Models

LikePostRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdStringUnique id of the post liked.