> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Notification Tray Status

> Observe and update notification tray seen status for unread indicators.

Notification tray status tracks whether the signed-in user's tray has been seen since the latest tray item occurred. Use it for tray badges, unread indicators, and "new notifications" affordances.

## Status Fields

| Concept                  | TypeScript           | iOS                  | Android               |
| ------------------------ | -------------------- | -------------------- | --------------------- |
| Tray is seen             | `isSeen`             | `isSeen`             | `isSeen()`            |
| Last tray occurrence     | `lastTrayOccurredAt` | `lastTrayOccurredAt` | `getLastOccurredAt()` |
| Last tray seen timestamp | `lastTraySeenAt`     | `lastTraySeenAt`     | `getLastSeenAt()`     |

<Note>
  The current public Flutter SDK source reviewed for this page does not expose notification tray seen-status APIs.
</Note>

## Parameters

| Operation                | Input                  | Required           | Platforms                | Description                                                                   |
| ------------------------ | ---------------------- | ------------------ | ------------------------ | ----------------------------------------------------------------------------- |
| Observe tray seen status | Signed-in user session | Yes                | TypeScript, iOS, Android | The SDK returns status for the current user; no explicit user ID is passed.   |
| Mark tray seen           | Seen timestamp         | Platform-dependent | TypeScript               | Timestamp to store as the tray seen time.                                     |
| Mark tray seen           | Current tray context   | Yes                | iOS, Android             | Marks the signed-in user's tray seen without an explicit timestamp parameter. |

## Observe Tray Seen Status

Observe tray seen status when your app needs a badge or "new notifications" indicator to stay current.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { notificationTray } from '@amityco/ts-sdk';

  const unsubscribe = notificationTray.getNotificationTraySeen(
    ({ data: status, loading, error }) => {
      if (loading) return;
      if (error) {
        handleError(error);
        return;
      }

      updateUI(status);
    },
  );

  unsubscribe();
  ```

  ```swift iOS theme={null}
  token = client.notificationTray
      .getNotificationTraySeen()
      .observe { object, error in
          if let error {
              handleError(error)
              return
          }

          if let status = object.snapshot {
              showSuccessMessage(status.isSeen)
          }
      }
  ```

  ```kotlin Android theme={null}
  AmityCoreClient.notificationTray()
      .getNotificationTraySeen()
      .subscribe(
          { status: AmityNotificationTraySeen -> showSuccessMessage(status.isSeen() == true) },
          { error -> handleGeneralError(error) }
      )
  ```
</CodeGroup>

## Mark Tray Seen

Mark the tray seen after the user actually views the notification tray.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { notificationTray } from '@amityco/ts-sdk';

  async function markNotificationTraySeen() {
    await notificationTray.markTraySeen(new Date().toISOString());
  }
  ```

  ```swift iOS theme={null}
  Task { @MainActor in
      do {
          try await client.notificationTray.markSeen()
      } catch {
          handleError(error)
      }
  }
  ```

  ```kotlin Android theme={null}
  AmityCoreClient.notificationTray()
      .markTraySeen()
      .subscribe(
          { showSuccessMessage("seen") },
          { error -> handleGeneralError(error) }
      )
  ```
</CodeGroup>

## Notes

* Mark the tray as seen when the user actually views the tray, not merely when a badge is rendered.
* Keep tray-level status separate from item-level status. Marking the tray seen does not replace item-level interaction tracking in your UI.
* Re-observe or refresh tray status when the app returns to the foreground if your badge must reflect cross-device activity.

## Related Topics

<CardGroup cols={2}>
  <Card title="Notification Items" href="./notification-items" icon="list">
    Query notification items and mark individual items as seen.
  </Card>

  <Card title="Notification Overview" href="./overview" icon="bell">
    Understand the notification tray SDK surface.
  </Card>
</CardGroup>
