Get notification list

TerraCore v0

Usage#

Unregister a registered device token (FCM token) to receive notifications. Supports both logged-in users and non-login users.

  • Logged-in users: get notification list of the user.
  • Non-login users: get broadcast notification list that are sent to the device.
coroutineScope.launch {
val deviceToken = callFunctionToGetFcmToken()
val query = GetNotificationListQuery().apply {
page = 1
pageSize = 20
deviceToken = deviceToken // required for the non-login users
}
val result = TerraNotification.getInstance(terraApp).getNotificationList(query)
if (result.isSuccess()) {
val notificationListResult = result.get()
} else {
// handle error if needed
val errorMessage = result.exception().message
}
}

References#