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
- Create a GetFeedRequest object using
GetFeedRequest.Builder
class by passing all the required parameters. - Call
getFeed()
function using the instance ofLMFeedClient
. - 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
- Fetch the topics in your community by calling the
getTopics()
function using the instance ofLMFeedClient
. - Select the topics on which you want to filter your universal feed and send the IDs of these topics in
topicIds
ofGetFeedRequest.Builder
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
page | Int | Page number for paginated feed data. | |
pageSize | Int | Page size for paginated feed data. |
GetFeedResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
posts | List<Post> | List of posts inside feed. | |
users | Map<String, User> | Map of user unique id to user object. | |
topics | Map<String, Topic> | Map of topic id to topic object. | |
widgets | Map<String, Widget> | Map of widget id to widget object. |