Get started with Message Center on Unity

The default Message Center is available for Unity with minimal integration required. Basic theming options are supported.

View as Markdown

Message Center provides an inbox for rich, HTML-based messages that users can view at their convenience. By default, when your app receives a push notification with a Message Center action, the Message Center automatically displays.

You can also display the Message Center manually by calling a simple method, making it easy to add a Message Center button to your app’s navigation.

Message Center inboxes are associated with channel IDs. Each device has a unique channel ID that persists across app launches, allowing users to access their message history.

Display the Message Center

Display the Message Center with a single method call. Pass null to open the inbox, or a message ID to open a specific message.

Airship.Shared.messageCenter.Display(null);

To customize the Message Center UI or navigation, see Embedding the Message Center

Fetch Messages

Retrieve messages from the inbox. GetMessages is asynchronous, so run it as a coroutine.

StartCoroutine(Airship.Shared.messageCenter.GetMessages((IEnumerable<InboxMessage> messages) => {
    foreach (InboxMessage message in messages) {
        Debug.Log(message.title);
    }
}));

Listen for Message Updates

The OnInboxUpdated event reports the current unread and total message counts whenever the inbox changes.

Airship.Shared.OnInboxUpdated += (uint unreadCount, uint totalCount) => {
    // Update badge or UI
};

Get the Unread Count

Retrieve the current unread count. GetUnReadCount is asynchronous, so run it as a coroutine.

StartCoroutine(Airship.Shared.messageCenter.GetUnReadCount((int unreadCount) => {
    // Update badge or UI
}));

Refresh Messages

Manually refresh the message list from the server. RefreshInbox is asynchronous, so run it as a coroutine.

StartCoroutine(Airship.Shared.messageCenter.RefreshInbox());

Mark Messages as Read

Mark a message as read:

Airship.Shared.messageCenter.MarkMessageRead("message-id");

Delete Messages

Delete a message:

Airship.Shared.messageCenter.DeleteMessage("message-id");