With Emarsys SDK, you can fetch inbox messages for a user.
This library is a plug and play inbox, that you can reuse and customise to your own branding.
Make sure to already have the Android Emarsys SDK added as a dependency in your Gradle file, and configured by calling Emarsys.setup()
in your Application class, then add the emarsys-mobile-inbox
module to your project.
The project provides different components to suit a variety of use-cases:
EmarsysInboxActivity
- An Activity that manages its own Fragments and lifecycles. Minimum setup required. Add it to yourAndroidManifest.xml
file and use an Intent to launch it.EmarsysInboxFragment
- A Fragment that manages the navigation betweenEmarsysInboxListFragment
andEmarsysInboxDetailFragment
. Can be embedded in any Activity as the primary navigation fragment.EmarsysInboxListFragment
- A Fragment that shows a list of messages in the user's inbox. Can be embedded in any Activity and will useEmarsysInboxViewModel
to notify it about any events, such as a message being selected. The Activity can then choose to either handle the selected Message itself, or transition to aEmarsysInboxDetailFragment
.EmarsysInboxViewModel
- A ViewModel that can be used to easily extend your own Activities and Fragments with the Emarsys Messaging Inbox functionality.
- The minimum Android version should be at least API level 24.
- Requires compileSdkVersion 31 or higher.
- Emarsys SDK is using AndroidX.
EmarsysInboxConfig.headerView = { context ->
createHeaderView(context)
}
EmarsysInboxConfig.headerBackgroundColor = <COLOR>
EmarsysInboxConfig.headerForegroundColor = <COLOR>
EmarsysInboxConfig.bodyBackgroundColor = <COLOR>
EmarsysInboxConfig.bodyForegroundColor = <COLOR>
EmarsysInboxConfig.bodyTintColor = <COLOR>
EmarsysInboxConfig.bodyHighlightTintColor = <COLOR>
EmarsysInboxConfig.activityIndicatorColor = <COLOR>
EmarsysInboxConfig.notOpenedViewColor = <COLOR>
EmarsysInboxConfig.imageCellBackgroundColor = <COLOR>
EmarsysInboxConfig.favImageOff = <RESOURCE_ID>
EmarsysInboxConfig.favImageOn = <RESOURCE_ID>
EmarsysInboxConfig.defaultImage = <RESOURCE_ID>
EmarsysInboxConfig.highPriorityImage = <RESOURCE_ID>
EmarsysInboxConfig.actionEventHandler = { context, eventName, payload ->
}
EmarsysInboxConfig.actionButtonStyler = { button ->
button.setTextColor(Color.WHITE)
button.cornerRadius = 10
}
- Distribution with AAR/Maven.
If you want to add this repository as a submodule of your project, so that you can pull new changes directly to your project and not have the inbox as a part of it:
-
In terminal, run:
git submodule add https://github.com/emartech/android-mobile-inbox <Name you want the submodule to have>
andgit submodule update --init --recursive
-
settings.gradle should look like this:
include ':<submodule name>' include ':app' rootProject.name = "<root project name>" project(':<submodule name>').projectDir = new File('<submodule name>/emarsys-mobile-inbox')
-
build.gradle (:app) should include:
implementation project(':<submodule name>')
-
If, at any moment, the inbox folder appears empty, run
git submodule update --init --recursive
. If it doesn't appear at all, rungit submodule add --force https://github.com/emartech/android-mobile-inbox <submodule name>
Should you have any suggestions or bug reports, please raise an Emarsys support request.
Please see our Code of Conduct for detail.
Please see our LICENSE for copyright and license information.