Skip to content
Last updated

Surveys (Optional)

Bubbl notifications can contain survey questions. The host app renders these in a modal.

What this adds

  • A dynamic survey UI built from Bubbl’s question schema.
  • Answer collection and submission to Bubbl.

Where to look in the host app

  • ModalFragment parses questions and builds views.
  • Layouts live in /Users/jackwright/Projects/Bubbl/bubbl-internal-android-host-app/app/src/main/res/layout/survey_*.

Key ideaYou don’t need to copy this exact UI. You only need to:

  1. Read questions from NotificationRouter.DomainNotification.
  2. Collect answers into SurveyAnswer objects.
  3. Call the SDK to submit.

Sample submission flow (simplified)

val answers = mutableListOf<SurveyAnswer>()
// Build answers by reading your custom UI fields

BubblSdk.submitSurvey(
    notificationId = notification.id.toString(),
    locationId = notification.locationId,
    answers = answers
) { success ->
    if (success) {
        Toast.makeText(context, "Thanks!", Toast.LENGTH_SHORT).show()
    }
}
Tooltip

If you don’t need surveys, you can skip all survey code and simply render media or CTAs.