Android Engagement SDK (BillDogEng)
📱 Android Engagement Suite
The billdog-eng SDK is a client-side Android meta-package (BOM) designed for the full engagement suite: Analytics, Outbound Messaging, In-App Surveys, and A/B Testing. Instead of importing separate SDK modules, developers import this single meta-package.
Bundled Modules
By declaring a dependency on billdog-eng, your application automatically receives the following stable client-side modules:
Analytics
Automatic event tracking, screen views, and user profiling.
Surveys
Native Jetpack Compose and XML survey presentation.
Messaging
Push notifications and behavior-driven in-app message triggers.
1. Installation
Add the engagement meta-package to your app-level build.gradle dependencies:
dependencies {
// Import the unified BillDog Engagement suite
implementation 'io.billdog:billdog-eng:1.2.0-beta.1'
}2. Initialization
Initialize the SDK once at application startup (typically inside your Application.onCreate()):
import android.app.Application
import io.billdog.core.BillDog
import io.billdog.analytics.BillDogAnalytics
import io.billdog.abtest.BillDogABTest
import io.billdog.inappmessages.BillDogInAppMessaging
// billdog-eng bundles no io.billdog.eng.BillDogEng facade — it re-exports the
// core client plus the engagement modules. Retain the managers you reuse.
val analytics = BillDogAnalytics()
lateinit var abTest: BillDogABTest
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Configure the core client once, globally
BillDog.configure(
context = this,
apiKey = "YOUR_API_KEY_HERE" // Starts with bd_public_test_ or bd_public_live_
)
// Register each engagement module — BillDog.use() wires networking
// and calls configure() on the module for you.
abTest = BillDogABTest(this)
BillDog.use(analytics)
BillDog.use(abTest)
BillDog.use(BillDogInAppMessaging.shared)
}
}3. Analytics & Identity
Associate events and custom user attributes for targeting and segments:
import io.billdog.core.BillDogAnalyticsEvent
// Associate the current user (persists the distinct id)
analytics.identify("user_12345")
// Identify with custom attributes for segmentation
analytics.identify(
userId = "user_12345",
properties = mapOf(
"plan" to "premium",
"signup_date" to "2026-06-18"
)
)
// Capture a custom engagement event — the module takes an event object
analytics.track(
BillDogAnalyticsEvent(
name = "level_completed",
properties = mapOf(
"level_id" to 14,
"difficulty" to "hard"
)
)
)4. In-App Surveys
Present in-app surveys dynamically or let events trigger them automatically.
import io.billdog.core.BillDog
import io.billdog.survey.SurveyPresentationHandler
// The core client (bundled in billdog-eng) exposes the survey presenter once configured
val presenter = BillDog.getSurveyPresenter()
// Present a survey by ID with lifecycle callbacks
presenter?.present(
surveyId = "nps_post_checkout",
activity = activity,
handler = SurveyPresentationHandler(
onPresent = { id -> Log.d("Survey", "Presented: $id") },
onDismiss = { id -> Log.d("Survey", "Dismissed: $id") },
onComplete = { id, result -> Log.d("Survey", "Respondent ID: ${result.respondent_id}") }
),
customerId = "user_12345",
customVariables = mapOf("checkout_method" to "google_pay")
)5. Remote Feature Flags
Engagement client SDKs read flags that are evaluated remotely by the server (ensuring clients cannot manipulate flag decisions).
// Fetch the latest flag + experiment assignments first (suspend — call from a coroutine)
abTest.fetchExperiments()
// Check if a remote feature flag is enabled (there is no isFeatureEnabled)
if (abTest.getFeatureFlag("new_checkout_flow")) {
// Show new checkout
}
// Get the assigned variant and its JSON payload
val variant = abTest.getFeatureFlagVariant("new_checkout_flow")
val payload = abTest.getFeatureFlagPayload("new_checkout_flow")6. In-App Message Triggers
Fire a named trigger to evaluate the in-app messages targeted to it and display any that match the current user:
// Evaluate and display any in-app message armed for this trigger
BillDogInAppMessaging.shared.checkForMessages(
trigger = "checkout_success_banner",
properties = mapOf("source" to "post_purchase")
)Dual-installation safety
billdog-eng library declares a capability constraint. This prevents compile-time conflicts or duplicate class definitions when installing billdog-core and billdog-eng side-by-side.Was this page helpful?
Or rate this page: