Skip to main content

In-App Notifications

In-app notifications are modal messages delivered through FCM while the app is in the foreground. They display as styled dialogs and are configured in the Positive User panel.

Display is handled automatically once onNotification() is wired up in your FirebaseMessagingService. No additional setup needed.


Custom fonts​

If your in-app message templates use named fonts, implement FontResolver so the SDK can load them from your app's assets:

UserCom.getInstance().setFontResolver { name ->
Typeface.createFromAsset(assets, "fonts/$name.ttf")
}

The name parameter is the font name as entered in the Positive User panel. Return Typeface.DEFAULT as a fallback for names you don't recognize.


Handling button clicks​

By default, buttons in in-app messages open their URL in Chrome Custom Tabs. To intercept clicks and handle navigation yourself, set a ClickHandler:

UserCom.getInstance().setInAppNotificationClickHandler { url ->
// Handle navigation to url
}

Chrome Custom Tabs​

When no ClickHandler is set, button URLs open in Chrome Custom Tabs. Customize their appearance in the builder:

UserCom.Builder(this, sdkKey, apiKey, domain)
.setCustomTabsBuilder(
CustomTabsIntent.Builder()
.setToolbarColor(Color.GREEN)
)
.build()

To disable Chrome Custom Tabs entirely and use the default browser instead:

UserCom.Builder(this, sdkKey, apiKey, domain)
.openLinksInChromeCustomTabs(false)
.build()