To integrate Stories into your Android application, you need to make sure that the basic integration of the Nudge Core SDK is done, if you have not already done it, check here.
Follow the steps below to complete the integration:
Step 1 : Install the nudgestoriesv2
package
nudgestoriesv2
packageAdd the following to your app's build.gradle
implementation 'com.nudgenow.nudgestoriesv2:nudgestoriesv2:1.0.0'
implementation ("com.nudgenow.nudgequizv2:nudgequizv2:1.0.0")
Step 2 : Add StoriesUi()
plugin
StoriesUi()
pluginDefine a stories
variable and add it into the list inplugins
property of NudgeProvider
StoriesUi stories = new StoriesUi();
NudgeProvider(context, nudge, Arrays.asList(stories)); // Along with any other plugins
val stories = StoriesUi()
nudgeProvider = NudgeProvider(context,
stories,
Arrays.asList(quiz) // Along with the others
)
Step 3 : Add the Stories component to your application
Add the below recycler view (Stories container) to your layout
<androidx.recyclerview.widget.RecyclerView
android:layout_margin="20dp"
android:id="@+id/carouselRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Now, to show stories to your end users first add the below snippet to the screen where you want to show the stories.
StoriesManager(activity, "test_strories", R.id.carouselRecyclerView)
StoriesManager(context, <event_name>, R.id.carouselRecyclerView)
That's it!
Our Nudge Core would now trigger Stories defined on your Dashboard using the StoriesUi
plugin.