Implement Inbox Messaging on Android
The MobilePush Android SDK provides convenience methods for refreshing the app inbox and managing messages, including retrieving, reading, and deleting them. For more information on these methods, see the InboxMessageManager
Method Reference.
You can enable Inbox Messaging while initializing the SDK, as shown in the following examples.
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.
Key | Value | SDK Versions 8.x and 9.x Availability |
---|---|---|
id | String | Yes |
alert | String? | Yes |
subject | String? | Yes |
startDateUtc | Date? | Yes |
sendDateUtc | Date? | Yes |
endDateUtc | Date? | Yes |
custom | String? | Yes |
customKeys | Map<String, String>? | Yes |
title | String? | Yes |
url | String? | Yes |
deleted | Boolean | Yes |
read | Boolean | Yes |
sound | String? | Yes |
subtitle | String? | Yes |
media | InboxMessage.Media? | Yes |
inboxMessageType | Int? | Available in version 9.x and later |
inboxSubtitle | String? | Available in version 9.x and later |
inboxMessage | String? | Available in version 9.x and later |
notificationMessage | NotificationMessage? | Available in version 9.x 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 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
, messageDeleted
, messageHash
, requestId
) are for internal SDK use. Avoid using these properties within a consuming application as they're subject to change.
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. However, due to Apple's payload size restrictions, all inbox fields can't be added to the push payload. Nevertheless, 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 when a user taps on an inbox push notification, enable or disable the setMarkMessageReadOnInboxNotificationOpen
feature in the PushConfigBuilder
.
By default, the SDK marks an inbox message as read when the user taps on the notification for an Alert+Inbox
message. You can toggle this behavior by enabling or disabling markMessageReadOnInboxNotificationOpen
in MarketingCloudConfig
.
The SDK doesn’t automatically present URLs from Alert+CloudPage
push messages. To handle the URLs from these messages, see Customize Notification Handling.
To sort inbox messages in your custom inbox implementation, use the value of sendDateUtc
from the Inbox Message returned by getMessages
and other getters.