Apps using version 3.2.0 and later of Iterable's Android SDK can save in-app messages to an inbox. This inbox displays a list of saved in-app messages and allows users to read them at their convenience. The SDK provides a default user interface for the inbox, which can be customized to match your brand's styles. This document describes how Android developers can add Iterable's Mobile Inbox functionality to your mobile app.
To learn how to use Iterable to send in-app messages that users can save to a mobile inbox, read Sending In-App Messages.
IMPORTANT
Versions 3.2.0 and higher of Iterable's Android SDK depend on the AndroidX support libraries. Migrate your app to use AndroidX before using version 3.2.0 or higher.
# In this article
# Installing Iterable's Android SDK
To add a mobile inbox to your Android app, first install Iterable's Android SDK.
# Displaying the mobile inbox
IMPORTANT
Iterable's mobile inbox UI is fragment-based: IterableInboxFragment requires a
FragmentManager, so its host must be a FragmentActivity (or its descendant,
AppCompatActivity). Compose-first apps often use a plain ComponentActivity as
their host, which has no FragmentManager—hosting the inbox fragment there
crashes when the fragment is attached. If your app is Compose-first, change the
host activity's base class to FragmentActivity / AppCompatActivity before
adding the inbox. (Iterable's Android SDK doesn't currently provide a
Compose-native inbox.)
Note that this requirement applies to the inbox UI only. Starting with SDK version 3.9.0, in-app messages themselves render correctly in Compose-first apps. For more information, see In-App Messages on Android.
In your app, show the mobile inbox when the user selects a specific tab or taps a particular button.
-
To show the inbox as a tab:
When using a Navigation component, add the
IterableInboxFragmentto the navigation graph XML:<fragment android:id="@+id/inboxFragment" android:name="com.iterable.iterableapi.ui.inbox.IterableInboxFragment" android:label="Inbox" tools:layout="@layout/iterable_inbox_fragment" /> -
To show the inbox as a separate activity in response to a button tap:
Use the provided
InboxActivitywrapper:Kotlin
startActivity(Intent(context, IterableInboxActivity::class.java))
Java
startActivity(new Intent(getContext(), IterableInboxActivity.class));
# Syncing a mobile inbox across many devices
Iterable's iOS and Android SDKs automatically sync a mobile inbox across all the devices on which a user has logged in to your app. Additionally, they sync the read state for each message.
If you're not using one of Iterable's mobile SDKs:
- To determine whether or not a message has been read, examine its
readfield, as returned byGET /api/inApp/getMessages. - To mark a message as read, call
POST /api/events/trackInAppOpen.
NOTE
For more information about cross-device read state syncing, see:
- Iterable's Android SDK, v3.2.12 release notes
- Iterable's iOS SDK, v6.2.21 release notes
# Customizing the mobile inbox
To learn how to customize the mobile inbox in an Android app, read Customizing Mobile Inbox on Android.
# Further reading
User guides:
- In-App Messages and Mobile Inbox
- Sending In-App Messages
- Events for In-App Messages and Mobile Inbox
Developer documentation:
- Iterable's iOS SDK
- Iterable's Android SDK
- In-App Messages Overview
- In-App Messages on iOS
- In-App Messages on Android
- Setting up Mobile Inbox on iOS
- Customizing Mobile Inbox on iOS
- Customizing Mobile Inbox on Android
- Animating In-App Messages with CSS
- Image Carousels in In-App Messages
- Testing and Troubleshooting In-App Messages
- In-App Messages Without the SDK
- Getting Started with Iterable's API
- API Endpoints and Sample Payloads