Content Cards
Learn about Content Cards for the Braze Android SDK, including the different data models and card-specific properties available for your Swift application.
When you’re ready to start customizing and using Content Cards, see Content Card customization.
Prerequisites
Before you can use Braze Content Cards, you’ll need to integrate the Braze Android SDK into your app. However, no additional setup is required.
Google fragments
In Android, the Content Cards feed is implemented as a fragment available in the Braze Android UI project. The ContentCardsFragment
class will automatically refresh and display the contents of the Content Cards and log usage analytics. The cards that can appear in a user’s ContentCards
are created on the Braze dashboard.
To learn how to add a fragment to an activity, see Google’s fragments documentation.
Card types and properties
The Content Cards data model is available in the Android SDK and offers the following unique Content Card types. Each type shares a base model, which allows them to inherit common properties from the base model, in addition to having their own unique properties. For full reference documentation, see com.braze.models.cards
.
Base card model
The base card model provides foundational behavior for all cards.
Property | Description |
---|---|
getId() |
Returns the card’s ID set by Braze. |
getViewed() |
Returns a boolean reflects if the card is read or unread by the user. |
getExtras() |
Returns a map of key-value extras for this card. |
getCreated() |
Returns the unix timestamp of the card’s creation time from Braze. |
getIsPinned |
Returns a boolean that reflects whether the card is pinned. |
getOpenUriInWebView() |
Returns a boolean that reflects whether Uris for this card should be opened in the Braze WebView or not. |
getExpiredAt() |
Gets the expiration date of the card. |
getIsRemoved() |
Returns a boolean that reflects whether the end user has dismissed this card. |
getIsDismissible() |
Returns a boolean that reflects whether the card is pinned. |
Image only
Image only cards are clickable full-sized images.
Property | Description |
---|---|
getImageUrl() |
Returns the URL of the card’s image. |
getUrl() |
Returns the URL that will be opened after the card is clicked. It can be a HTTP(s) URL or a protocol URL. |
getDomain() |
Returns link text for the property URL. |
Captioned image
Captioned image cards are clickable, full-sized images with accompanying descriptive text.
Property | Description |
---|---|
getImageUrl() |
Returns the URL of the card’s image. |
getTitle() |
Returns the title text for the card. |
getDescription() |
Returns the body text for the card. |
getUrl() |
Returns the URL that will be opened after the card is clicked. It can be a HTTP(s) URL or a protocol URL. |
getDomain() |
Returns the link text for the property URL. |
Classic
A classic card without an image included will result in a text announcement card. If an image is included, you will receive a short news card.
Property | Description |
---|---|
getTitle() |
Returns the title text for the card. |
getDescription() |
Returns the body text for the card. |
getUrl() |
Returns the URL that will be opened after the card is clicked. It can be a HTTP(s) URL or a protocol URL. |
getDomain() |
Returns the link text for the property URL. |
getImageUrl() |
Returns the URL of the card’s image, applies only to the classic Short News Card. |
Card methods
All Card
data model objects offer the following analytics methods for logging user events to Braze servers.
Method | Description |
---|---|
logImpression() |
Manually log an impression to Braze for a particular card. |
logClick() |
Manually log a click to Braze for a particular card. |
setIsDismissed() |
Manually log a dismissal to Braze for a particular card. If a card is already marked as dismissed, it cannot be marked as dismissed again. |
Next steps
When you’re ready to start customizing and using Content Cards, seeContent Card customization.