Content Card integration
Learn how to set up iOS, Android, and FireOS Content Cards for the Xamarin platform.
The Braze SDK includes a default card feed to get you started with Content Cards. The default card feed included with the Braze SDK will handle all analytics tracking, dismissals, and rendering for a user’s Content Cards.
For information on how to integrate the Content Cards into your Xamarin app, see our Android integration guide and iOS integration guide.
Prerequisites
To use this feature, you’ll need to integrate Braze SDK for the Xamarin platform.
Content Card methods
You can use these additional methods to build a custom Content Cards Feed within your app:
Method | Description |
---|---|
requestContentCardsRefresh() |
Requests the latest Content Cards from the Braze SDK server. |
getContentCards() |
Retrieves Content Cards from the Braze SDK. This will return the latest list of cards from the server. |
logContentCardClicked(cardId) |
Logs a click for the given Content Card ID. This method is used only for analytics. |
logContentCardImpression(cardId) |
Logs an impression for the given Content Card ID. |
logContentCardDismissed(cardId) |
Logs a dismissal for the given Content Card ID. |
Content Card data model
The Braze Xamarin SDK has three unique Content Cards card types that share a base model: banner, captioned image, and classic. Each type inherits common properties from a base model and has the following additional properties.
Base Content Card model properties
Property | Description |
---|---|
idString |
The card’s ID set by Braze. |
created |
The UNIX timestamp of the card’s creation time from Braze. |
expiresAt |
The UNIX timestamp of the card’s expiration time. When the value is less than 0, it means the card never expires. |
viewed |
Whether the card is read or unread by the user. This does not log analytics. |
clicked |
Whether the card has been clicked by the user. |
pinned |
Whether the card is pinned. |
dismissed |
Whether the user has dismissed this card. Marking a card as dismissed that has already been dismissed will be a no-op. |
dismissible |
Whether the card is dismissible by the user. |
urlString |
(Optional) The url string associated with the card click action. |
openUrlInWebView |
Whether URLs for this card should be opened in Braze’s WebView or not. |
isControlCard |
Whether this card is a control card. Control cards should not be displayed to the user. |
extras |
The map of key-value extras for this card. |
isTest |
Whether this card is a test card. |
For a full reference of the base card, see the Android and iOS documentation.
Banner Content Card model properties
Banner cards are clickable, full-sized images.
Property | Description |
---|---|
image |
The URL of the card’s image. |
imageAspectRatio |
The aspect ratio of the card’s image. It is meant to serve as a hint before image loading completes. Note that the property may not be supplied in certain circumstances. |
For a full reference of the banner card, see the Android and iOS documentation (now renamed to image only).
Captioned image Content Card model properties
Captioned image cards are clickable, full-sized images with accompanying descriptive text.
Property | Description |
---|---|
image |
The URL of the card’s image. |
imageAspectRatio |
The aspect ratio of the card’s image. It is meant to serve as a hint before image loading completes. Note that the property may not be supplied in certain circumstances. |
title |
The title text for the card. |
cardDescription |
The description text for the card. |
domain |
(Optional) The link text for the property URL, for example, "braze.com/resources/" . It can be displayed on the card’s UI to indicate the action/direction of clicking on the card. |
For a full reference of the captioned image card, see the Android and iOS documentation.
Classic Content Card model properties
Classic cards have a title, description, and an optional image on the left of the text.
Property | Description |
---|---|
image |
(Optional) The URL of the card’s image. |
title |
The title text for the card. |
cardDescription |
The description text for the card. |
domain |
(Optional) The link text for the property URL, for example, "braze.com/resources/" . It can be displayed on the card’s UI to indicate the action/direction of clicking on the card. |
For a full reference of the classic (text announcement) Content Card, see the Android and iOS documentation. For a full reference of the classic image (short news) card, see the Android and iOS documentation.
GIF Support
By default, the native Braze Android SDK does not provide animated GIF support for Content Cards—however, you can use a third-party image library to display GIFs instead. For more information, see Android Content Cards: GIFs.
By default, the Braze Swift SDK does not provide animated GIF support for Content Cards—however, you can wrap your own view or a third-party view in an instance of GIFViewProvider
. For a full walkthrough, see Tutorial: GIF Support for Swift Content Cards.