API Reference

To integrate Quizzes 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 nudgequizv2 package

Add the following to your app's build.gradle

implementation 'com.nudgenow.nudgequizv2:nudgequizv2:1.0.0'
implementation ("com.nudgenow.nudgequizv2:nudgequizv2:1.0.0")

Step 2: Add QuizUi() plugin

Define a quiz variable and add it into the list inplugins property of NudgeProvider

QuizUi quiz = new QuizUi();

NudgeProvider(context, nudge, Arrays.asList(quiz)); // Along with any other plugins 
val quiz = QuizUi()
nudgeProvider = NudgeProvider(context,
            nudge,
            Arrays.asList(quiz) // Along with the others
        )

Step 3 : Track event where you want to show the quiz

Inside your application, now you can track any event and configure a quiz on the same event in the dashboard. Once the user matches the trigger conditions he will see the quiz

Nudge.track("NAME_OF_EVENT", eventProperties, new Nudge.TrackCallback() {
    @Override
    public void onSuccess(String response) {
        // Handle successful tracking
    }

    @Override
    public void onError(Exception e) {
        // Handle error in tracking
    }
});
Nudge.track(eventType, eventProperties, object : Nudge.TrackCallback {
    override fun onSuccess(response: String) {
        // Handle successful tracking
    }

    override fun onError(e: Exception) {
        // Handle error in tracking
    }
})

That's it!

Our Nudge Core would now trigger Quiz defined on your Dashboard using the QuizUi plugin.