How to Start Feed with Specific Posts?
Starting the feed from a specific post improves content discovery, especially when users land via shared links or post thumbnails. This guide shows how to use the LikeMinds Feed Android SDK to launch a feed that begins from a defined list of posts—ideal for video feed experiences.
Prerequisites
Before you begin, ensure the following:
- LikeMinds Feed Android SDK: The SDK must be properly installed and initialized in your Android project. Refer to the installation guide if needed.
- Basic Understanding of Android: Familiarity with Android Fragments and concepts of Object-Oriented Programming (OOPS)
- Post ID(s): You must have the post ids of the specific posts you want to start the feed with.
Steps to start the feed with specific post
Step 1: Create instance of Video Feed Screen
- Create an instance of
LMFeedVideoFeedProps
and pass thepostIds
you want to start the feed instartFeedWithPostIds()
- Pass the created instance of
LMFeedVideoFeedProps
ingetInstance()
function to create an instance of the Video Feed Screen.
val props = LMFeedVideoFeedProps.Builder()
.startFeedWithPostIds(listOf(startFeedWithPostId))
.build()
val fragment = LMFeedVideoFeedFragment.getInstance(
feedType = LMFeedType.UNIVERSAL_FEED, // change to LMFeedType.PERSONALIZED_FEED based on your preference
props = props
)
Step 2: Use the created instance to render the feed
Use the instance of fragment created in above step in successCallback
, as mentioned in the last step of Getting Started Guide.
// pass this successCallback to LMFeedCore.showFeed()
val successCallback = { response : UserResponse? ->
// inflate video feed fragment in your activity
val containerViewId = R.id.frame_layout
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(containerViewId, fragment, containerViewId.toString())
transaction.commit()
Unit
} // callback triggered when the initiate user call is successful
You can pass one or multiple post ids depending on your requirement. The feed will start from the first post in the list and flow naturally afterward.