Self-handled cards give you the flexibility of creating Card Campaigns on the MoEngage Platform and displaying the cards anywhere inside the application. SDK provides APIs to fetch the campaign’s data using which you can create your own view for cards.Documentation Index
Fetch the complete documentation index at: https://moengage-ios-release-notes-breaking-changes-doc-1961.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
SDK Installation
Installation
To add MoEngage Cards SDK to your application, edit the application’s pubspec.yaml file and add the below dependency to it:This plugin is dependent on moengage_flutter plugin. Make sure you have installed the moengage_flutter plugin as well. Refer to the documentation for the same.
Android Installation
iOS Installation
In the case of iOS, the native dependency is part of the Cards flutter SDK itself, so there is no need to include any additional dependency for supporting Cards.Initialize Cards
MoEngage Cards module can be initialized in the widget where the cards module is being used.Get Cards Info
Fetch All the cards campaign data that are eligible to show for the particular user which returns data as CardsInfo. For a complete list of data models please refer to the API documentation.Widget and Widget Id Mapping
Basic Card/Illustration Card
| Widget Id | Widget Type | Widget Information |
|---|---|---|
| 0 | Image (WidgetType.IMAGE) | Image widget in the card. |
| 1 | Text (WidgetType.TEXT) | Header text for the card. |
| 2 | Text (WidgetType.TEXT) | Message text for the card. |
| 3 | Button (WidgetType.Button) | Call to action(CTA) for the card. |
Refresh Cards
Use the refreshCards*()*** API to refresh cards on the User Demand. This API can be used to mimic Pull to refresh behavior.Fetch Cards
Use the fetchCards*()*** API to fetch cards for the User. This API can be used to sync latest cards data.Inbox Loaded
You can show the cards on a separate screen or a section of the screen. When the cards screen/section is loaded call onCardsSectionLoaded().Inbox UnLoaded
Call onCardSectionUnloaded() when the screen/section is no longer visible or going to the background.Fetch Categories
To fetch all the categories for which cards are configured, use the getCardsCategories() API.All Cards Categories Enabled
To fetch all the categories for which cards are configured, use the isAllCategoryEnabled() API.Fetch Cards for Categories
To fetch cards eligible for display for a specific category use the getCardsForCategory() API.Get New Cards Count
To obtain the new cards count use getNewCardsCount() method as shown below:Card Shown
Call the cardShown() API to notify a card is shown to the user.Card Clicked
Call the cardClicked() API to notify a card is shown to the user.Delete Card
Call the deleteCard() API to delete a card.Mark Card Delivered
To track delivery to the card section of the application call the cardDelivered() API when the cards section of the application is loaded.Delete Multiple Cards
Call the deleteCards() API to delete a card.Get Unclicked Cards Count
To obtain the unclicked cards count use getUnClickedCardsCount() method as shown below.App Open Card Sync Listener
Set this listener to get a callback for card sync on the App opened. This listener should be set before calling initialize() API. In most cases, this API is not required.The hybrid framework does not support the MoEngage default Card. Only the Self-handled Card is supported.