Skip to main content

Mark Notification Read

You can use the following function from the LikeMinds Android SDK to mark the notifications that have been clicked by user in your application, as read.

Steps to mark a notification as read

  1. Create a MarkReadNotificationRequest object using MarkReadNotificationRequest.Builder class by passing all the required parameters.
  2. Call markReadNotification() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<Nothing>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of MarkReadNotificationRequest
val markReadNotificationRequest = MarkReadNotificationRequest.Builder()
.activityId("ENTER ACTIVITY ID") // id of the notification activity which is to be marked as read
.build()
// get response (LMResponse<Nothing>)
val response = LMFeedClient.getInstance().markReadNotification(markReadNotificationRequest)
if (response.success) {
// your function to process the response dataa
processNotificationRead(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}

MarkReadNotificationRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
activityIdStringID of the notification activity which is to be marked as read.