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
- Create a LikePostRequest object using
LikePostRequest.Builder
class by passing all the required parameters. - Call
likePost()
function using the instance ofLMFeedClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | Unique id of the post liked. |