API Reference
This document provides information on how to use the Messaging APIs to receive and display content card views in your application.
getContentCardUIFlow
The getContentCardUIFlow method returns a cold Flow of AepUI objects for the provided surface. These AepUI objects represent templated content cards whose UI can be rendered using provided card composables. Content is fetched lazily when the flow is collected.
Calling this API will not download content cards from Adobe Journey Optimizer; it will only retrieve the content cards that are already downloaded and cached by the Messaging extension. You must call updatePropositionsForSurfaces API from the AEPMessaging extension with the desired surfaces prior to calling this API.
Syntax
Copied to your clipboardfun getContentCardUIFlow(): Flow<Result<List<AepUI<*, *>>>>
Example
Copied to your clipboard// Download the content cards for homepage surface using Messaging extensionval surfaces = mutableListOf<Surface>()val surface = Surface("homepage")surfaces.add(surface)Messaging.updatePropositionsForSurfaces(surfaces)// Initialize the ContentCardUIProviderval contentCardUIProvider = ContentCardUIProvider(surface)// get the content cards within a view modelclass MyScreenViewModel : ViewModel() {private val contentCardUIProvider = ContentCardUIProvider(surface)private val _aepUIList = MutableStateFlow<List<AepUI<*, *>>>(emptyList())val aepUIList: StateFlow<List<AepUI<*, *>>> = _aepUIList.asStateFlow()// Obtain the flow without a coroutine context, then collect itval contentCardFlow = contentCardUIProvider.getContentCardUIFlow()init {viewModelScope.launch {contentCardFlow.collect { result ->result.onSuccess { aepUi -> _aepUIList.value = aepUi }}}}}
getContentCardUI (Deprecated)
Deprecated — use getContentCardUIFlow instead.
The getContentCardUI suspend function is retained for binary compatibility with apps built against earlier releases. It eagerly fetches content before returning the flow and requires a coroutine call site to obtain the flow reference.
Syntax
Copied to your clipboard@Deprecated("Use getContentCardUIFlow() instead.")suspend fun getContentCardUI(): Flow<Result<List<AepUI<*, *>>>>

