# In app message
# Receiving a notification
In-app message
In-app message will be displayed as default Alert Dialog. Because it’s created from application context without any theme, they’ll be probably a necessary for style this Dialog to match your app style.
In-app dialog buttons
If you pass a link parameter to in-app push data, then an in-app dialog will show two buttons
- negative to dismiss dialog with
@string/user_com_in_app_message_close_button
text - positive with text from
action_button_title
parameter
If link parameter will be empty then only positive button with action_button_title
text will be displayed.
To change default “Close” button just override specific string in values/strings.xml
.
<string name="user_com_in_app_message_close_button">Dismiss</string>
Stylize in app dialog
To change positive button color override user_com_in_app_message_dialog_positive
color in values/colors.xml:
<color name="user_com_in_app_message_dialog_positive">@color/accent</color>
Remember to pass color explicit without using ?attr
value.
You can also style in app dialog overriding one of below styles using by User.com SDK:
User.com.InApp.Dialog.Button.Positive
- positive button style
<style name="User.com.InApp.Dialog.Button.Positive" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
<item name="android:textColor">@color/user_com_in_app_message_dialog_positive</item>
</style>
User.com.InApp.Dialog.Button.Negative
- negative (Close) button style
<style name="User.com.InApp.Dialog.Button.Negative" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
<item name="android:textColor">?android:textColorSecondary</item>
</style>
User.com.InApp.Dialog
- a whole in app dialog style
<style name="User.com.InApp.Dialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="buttonBarPositiveButtonStyle">@style/User.com.InApp.Dialog.Button.Positive</item>
<item name="buttonBarNegativeButtonStyle">@style/User.com.InApp.Dialog.Button.Negative</item>
</style>
Chrome Custom Tabs
If In App Message contains link parameter and user click on positive Dialog button then he will be redirected to the browser. By default it will be Chrome Custom Tabs (opens new window) that you can customize to match your app style by invoke a UserCom.Builder.setCustomTabsBuilder(CustomTabsIntent.Builder)
function:
@Override
public void onCreate() {
…
new UserCom.Builder(…)
.setCustomTabsBuilder(getCustomTabsBuilder())
.build();
}
private static CustomTabsIntent.Builder getCustomTabsBuilder() {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(Color.GREEN);
return builder;
}
You can also disable this feature permanently using UserCom.Builder.openLinksInChromeCustomTabs(boolean)
method:
UserCom.Builder(…).openLinksInChromeCustomTabs(false).build();