Create and Show a Survey

Prev Next
  1. Create a Survey Object

    private lateinit var surveyView: XeboSurveyView
  2. Initialization and Performance (optional)

    Call preWarmSurvey early (e.g., in Application.onCreate or Activity.onCreate) to ensure surveys load instantly.

    XeboSurveyView.preWarmSurvey(this)
  3. Initialize the Survey object

    surveyView = XeboSurveyView(this)

   4. InApp Survey

  The In-App Survey is a native Android survey that appears inside your app without redirecting users to an external               browser or WebView. It:

  • Fetches survey configuration from the Xebo platform using a Collector ID and an API key (x-api-key), so surveys are managed remotely from the Xebo dashboard — no app update needed to change questions.

  • Renders questions natively (not in a WebView) for a smooth, high-performance experience that matches the host app's look and feel.

  • Provides lifecycle callbacks via XeboNativeDelegate so your app knows when the survey is completed, dismissed, or when an individual question is saved.

    Supported Questions Types:

    Question Type

    Description

    Variants / Styles

    Intro / Welcome

    A static welcome screen with a "Start Survey" button.

    —

    Single Choice

    User picks one option from a list.

    Button Group (default), Radio Buttons

    Multiple Choice

    User picks one or more options.

    Checkboxes (default), Chip Group

    Dropdown

    User picks one option from a dropdown picker.

    —

    Single Text Box

    Free-text input field.

    Text (default), Email, Number; supports min/max length validation and multiline

    Multiple Text Box

    Multiple named input fields in one question.

    Each field can have its own input type (text, email, number)

    NPS (Net Promoter Score)

    0–10 scale for loyalty/recommendation measurement.

    Single (one scale), Multiple (grid with rows), Pro (with conditional follow-up questions); zone colors configurable (detractor / passive / promoter)

    Rating

    Star/emoji/numeric rating scale.

    Single (one scale), Multiple (grid with rows), Pro (with follow-ups); styles: Stars, Emoji, Numeric

    Thank You

    End-of-survey message.

    Static (fixed message), Redirect (auto-navigates after a delay); supports social media links

##Minimum Paramas
XeboSurvey.showInApp(
    activity = this,
    collectorId = "YOUR_COLLECTOR_ID",
    xApiKey = "YOUR_API_KEY",
    zone = "az2"
)


##With delegate callbacks
XeboSurvey.showInApp(
    activity = this,
    collectorId = "YOUR_COLLECTOR_ID",
    xApiKey = "YOUR_API_KEY",
    zone = "az2",
    delegate = object : XeboNativeDelegate {
        override fun onSurveyCompleted(response: SurveyResponse) {
            // all answers submitted
        }

        override fun onPartialResponse(response: SurveyResponse) {
            // partial answer submitted (per question)
        }

        override fun onSurveyDismissed() {
            // user closed the survey
        }

        override fun onSubmissionFailed(error: String) {
            // something went wrong
        }
    }
)

##imports required 
import com.example.xebompack.XeboSurvey
import com.example.xebompack.XeboNativeDelegate
import com.example.xebompack.models.SurveyResponse
  1. Load a full screen survey

// parent: FragmentActivity
// delegate: XeboSurveyDelegate
// surveyURL: String? (survey URL)
surveyView.loadFullscreenSurvey(this, this, surveyUrl)
  1. Load survey after N number of visits

// visits: Int
// parent: FragmentActivity
// delegate: XeboSurveyDelegate
// surveyURL: String? (survey URL)
surveyView.loadSurveyAfter(N, this, this, surveyUrl)
  1. Load the survey with Lowest response

// List of survey UUIDs
val surveyUUIDs = listOf(
    "uuid1",
    "uuid2",....
)

// Xebo API key
val apiKey = "YOUR_XEBO_API_KEY"

// Load the survey with the lowest response count
surveyView.loadLowestResponseSurvey(
    parent = this,          // FragmentActivity
    delegate = this,        // XeboSurveyDelegate
    surveyUUIDs = surveyUUIDs,
    apiKey = apiKey
)