Configure Marketing Cloud Engagement
Runtime Toggles
Listen for Events
Track View States
Prevent or Delay Display
Customize Fonts
Set the Status Bar Color
Button Action Methods
Event Tracking
Handle URLs
Data Protection and Privacy
Changelog
Configure your app so that the Android OS matches the color scheme of your app.
The SDK doesn’t use AppCompatActivity. As a result, the OS doesn’t inherit the status bar of your app color automatically. Instead, you must define a custom status bar color. The SDK applies this color on Android 5 (Lollipop) and later.
Use this code to set the status bar color in version 11 of the SDK for Android.
1// set at configuration time
2SFMCSdk.configure(applicationContext as Application, SFMCSdkModuleConfig.build {
3 inAppMessagingFeatureModuleConfig = InAppMessagingFeatureConfig.builder().apply {
4 setStatusBarColor(
5 ContextCompat.getColor(this as Context, R.color.colorPrimary)
6 )
7 }.build()
8})
9
10// OR set after configuration time
11InAppMessagingFeature.requestSdk { inAppMessagingFeatureModule ->
12 inAppMessagingFeatureModule.getInAppMessageManager().setStatusBarColor(
13 ContextCompat.getColor(this as Context, R.color.colorPrimary)
14 )
15}Use this code to set the status bar color in version 10 of the SDK for Android.
1MarketingCloudSdk.requestSdk { engagementSdk ->
2 engagementSdk.inAppMessageManager.setStatusBarColor(
3 ContextCompat.getColor(this as Context, R.color.colorPrimary)
4 )
5}Use this code to set the status bar color in version 8 of the SDK for Android.
1SFMCSdk.requestSdk { sdk ->
2 sdk.mp {
3 it.inAppMessageManager.setStatusBarColor(
4 ContextCompat.getColor(this as Context, R.color.colorPrimary)
5 )
6 }
7}Use this code to set the status bar color in version 7 of the SDK for Android.
1MarketingCloudSdk.requestSdk { sdk->
2 sdk.inAppMessageManager.setStatusBarColor(
3 ContextCompat.getColor(this as Context, R.color.colorPrimary)
4 )
5}