Skip to main content

Like Comment

The LikeMinds Android Feed SDK, users can express their appreciation for a comment by "liking" it. This feature allows members to indicate their support or agreement with a particular comment in a simple and intuitive manner.

Steps to like a comment

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

Same function can be used to like a reply as well. Just pass the id of the reply as comment id.

Models

LikeCommentRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdStringPost ID of the liked comment.
commentIdStringUnique ID of the comment liked.