Skip to main content

Fetch Notification Feed

Notification feed is a great way to populate notifications for a user. You can achieve the same with LikeMinds Android SDK, by following the steps given below.

Steps to fetch notification feed

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

Models

GetNotificationFeedRequest

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

GetNotificationFeedResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
activitiesList<Activity>List of activities inside notification feed.
usersMap<String, User>Map of user unique id to user object.
topicsMap<String, Topic>Map of topic id to topic object.