Implement Inbox Messaging on Android

The MobilePush SDK for Android provides convenience methods for refreshing the app inbox and managing messages, including retrieving, reading, and deleting them. For more information about these methods, see InboxMessageManager Method Reference.

These code examples show how to enable Inbox Messaging during the SDK initialization process. If you use version 10 of the SDK, use this code.

If you use version 8 of the SDK, use this code.

If you use version 7 or earlier of the SDK, use this code.

The MobilePush SDK offers these convenience methods for retrieving inbox messages:

Each method returns a list of InboxMessage Objects. A consuming application can access these properties within each message object.

KeyTypeNullableSDK Version Availability
idStringNoVersion 8 and later
alertStringYesVersion 8 and later
subjectStringYesVersion 8 and later
startDateUtcDateYesVersion 8 and later
sendDateUtcDateYesVersion 8 and later
endDateUtcDateYesVersion 8 and later
customStringYesVersion 8 and later
customKeysMap<String,String>YesVersion 8 and later
titleStringYesVersion 8 and later
urlStringYesVersion 8 and later
deletedBooleanNoVersion 8 and later
readBooleanNoVersion 8 and later
soundStringYesVersion 8 and later
subtitleStringYesVersion 8 and later
mediaInboxMessage.MediaYesVersion 8 and later
inboxMessageTypeIntYesVersion 9 and later
inboxSubtitleStringYesVersion 9 and later
inboxMessageStringYesVersion 9 and later
notificationMessageNotificationMessageYesVersion 9 and later

The inboxMessageType classifies inbox messages using integer values to represent different types. A value of 1 indicates an Inbox 1.0 message, 2 signifies an Inbox 2.0 message, and 3 represents a Push Copy to Inbox (PCTI) message. This attribute applies to Inbox 1.0, Inbox 2.0, and PCTI. Additionally, inboxSubtitle and inboxMessage are available to Inbox 2.0, while notificationMessage is specific to PCTI.

The remaining properties in the message dictionary, such as contentType and requestId, are reserved for internal use. Don’t use these properties in your app.

The Alert + Inbox feature is designed to enable users to tap on an inbox push notification and get redirected to the corresponding inbox message. The inbox data is added to the push notification payload. Because of restrictions on the payload size, you can’t add all inbox fields to the push payload. However, users are still redirected to the message without issues, and all fields become available when they return to the inbox.

Initially, these fields aren’t available in the Alert + Inbox Message dictionary:

  • sendDateUtc
  • startDateUtc
  • endDateUtc
  • subject

To automatically mark an inbox message as read after a user taps an inbox push notification, enable the setMarkMessageReadOnInboxNotificationOpen feature in the PushConfigBuilder.

By default, if user taps on the notification for an Alert+Inbox message, the SDK marks the inbox message as read. You can toggle this behavior by changing the value of markMessageReadOnInboxNotificationOpen in MarketingCloudConfig.

The SDK doesn’t automatically present URLs from Alert+CloudPage push messages. To handle the URLs from these messages, customize notification handling for the app.

To sort inbox messages in your custom inbox implementation, use the value of sendDateUtc from the Inbox Message returned by getMessages.