Skip to main content

Universal Feed

The LikeMinds Android feed SDK provides a powerful Universal Feed feature for your Android app. Easily integrate a versatile feed that allows all the users in the community to view a common feed

Steps to fetch Universal feed

  1. Create a GetFeedRequest object using GetFeedRequest.Builder class by passing all the required parameters.
  2. Call getFeed() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<GetFeedResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of GetFeedRequest
val getFeedRequest = GetFeedRequest.Builder()
.page(1) // page number for paginated feed data
.pageSize(10) // page size for paginated feed data
// get response (LMResponse<GetFeedResponse>)
val response = LMFeedClient.getInstance().getFeed(getFeedRequest)
if (response.success) {
// your function to process the response data
processGetFeedResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Steps to fetch Universal feed with selected topics

  1. Fetch the topics in your community by calling the getTopics() function using the instance of LMFeedClient.
  2. Select the topics on which you want to filter your universal feed and send the IDs of these topics in topicIds of GetFeedRequest.Builder.
  3. You will get posts from universal feed that has atleast one of these topics.
CoroutineScope(Dispatchers.IO).launch {
// object of GetFeedRequest
val getFeedRequest = GetFeedRequest.Builder()
.page(1) // page number for paginated feed data
.pageSize(10) // page size for paginated feed data
.topicIds(listOf("ENTER TOPIC ID")) // fetches posts with given topics from feed
.build()
// get response (LMResponse<GetFeedResponse>)
val response = LMFeedClient.getInstance().getFeed(getFeedRequest)
if (response.success) {
// your function to process the response data
processGetFeedResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Models

GetFeedRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
pageIntPage number for paginated feed data.
pageSizeIntPage size for paginated feed data.

GetFeedResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
postsList<Post>List of posts inside feed.
usersMap<String, User>Map of user unique id to user object.
topicsMap<String, Topic>Map of topic id to topic object.
widgetsMap<String, Widget>Map of widget id to widget object.