Skip to main content
SDK Version

Inbox

The Inbox feature allows your application to provide users with an in-app message center, ensuring that notifications remain accessible even after they are dismissed from the system tray. By implementing an inbox, you can significantly increase user engagement, as messages will always be available directly within your app.

To enable this functionality, include the actito-inbox module in your project. This module provides all the APIs necessary to retrieve, open, and manage inbox messages.

dependencies {
def actito_version = 'REPLACE_WITH_LATEST_VERSION'
implementation "com.actito:actito-inbox:$actito_version"
}
Requirements

Before getting started with this module, ensure that the following steps have been completed:

Overview

The standard implementation uses a device-level inbox, meaning each device maintains its own independent message list — regardless of the authenticated user. This design ensures that every device receives and stores messages consistently, even before a user logs in.

The inbox is powered by a Kotlin Flow, which makes it simple to observe real-time updates to messages and badges.

Important

You should not use both the actito-inbox and actito-user-inbox modules within the same application. Each module provides its own independent implementation of the inbox feature — actito-inbox manages messages at the device level, while actito-user-inbox manages them at the user level. Using both simultaneously can cause synchronization issues, and unexpected behavior. Choose the module that best fits your use case and integrate only one inbox type per app.

If your application requires an inbox that persists across multiple devices for the same authenticated user, refer to the User Inbox documentation for implementation details.

Listening to Inbox changes

The inbox can be observed through the Actito Inbox API, allowing your UI to automatically reflect changes as messages arrive, are read, or removed.

Example — observing inbox items from an Activity:

lifecycleScope.launch {
Actito.inbox().itemsStream.collect { items ->
// Update your UI with the new list of inbox items
}
}

Similarly, you can listen for updates to the number of unread messages:

lifecycleScope.launch {
Actito.inbox().badgeStream.collect { unreadCount ->
// Update the badge count in your UI
}
}

For synchronous access, you can retrieve the current state directly:

// Retrieve the list of inbox items
val items = Actito.inbox().items

// Retrieve the current unread badge count
val badge = Actito.inbox().badge

Opening Inbox items

Once you hold a reference to an inbox item, you can open it by invoking the following method:

val item: ActitoInboxItem

try {
val notification = Actito.inbox().open(item)

// Optionally, present the notification using the managed Push UI
Actito.pushUI().presentNotification(activity, notification)
} catch (e: Exception) {
// Handle the error
}

Managing Inbox items

You can manage the inbox contents through a variety of operations provided by the SDK.

Marking messages as read

To mark a specific message as read:

val item: ActitoInboxItem

Actito.inbox().markAsRead(item)

To mark all messages as read:

Actito.inbox().markAllAsRead()

Removing messages

To remove a single message from the inbox:

val item: ActitoInboxItem

Actito.inbox().remove(item)

To clear all messages from the inbox:

Actito.inbox().clear()