1. Add Dependency
Add the Stringboot SDK to your app-level build.gradle.kts:
dependencies {
implementation ( "com.stringboot:stringboot-android-sdk:1.2.3" )
}
Click Sync Now to download the SDK.
Add your API credentials to AndroidManifest.xml inside the <application> tag:
< application ... >
<!-- Stringboot Configuration -->
< meta-data
android:name = "com.stringboot.api_url"
android:value = "https://api.stringboot.com" />
< meta-data
android:name = "com.stringboot.api_token"
android:value = "YOUR_API_TOKEN_HERE" />
< meta-data
android:name = "com.stringboot.cache_size"
android:value = "1000" />
</ application >
Replace YOUR_API_TOKEN_HERE with your actual API token from the Stringboot Dashboard.
3. Initialize SDK
We recommend initializing the SDK in your Application class. This “Production-Ready” snippet includes setup for all features (A/B Testing, FAQs, Logging).
class MyApplication : Application () {
override fun onCreate () {
super . onCreate ()
StringProvider. initialize (
context = this ,
cacheSize = 1000
)
// Trigger initial sync
CoroutineScope (Dispatchers.IO). launch {
StringProvider. refreshFromNetwork (StringProvider. deviceLocale ())
}
}
}
class MyApplication : Application () {
override fun onCreate () {
super . onCreate ()
// 1. Define Analytics Handler (for A/B Testing)
val analyticsHandler = object : StringbootAnalyticsHandler {
override fun onExperimentAssigned (assignment: ExperimentAssignment ) {
// Log to your analytics provider
Firebase.analytics. logEvent ( "experiment_assigned" ) {
param ( "experiment_key" , assignment.experimentKey)
param ( "variant" , assignment.variantName)
}
}
override fun onExperimentViewed (key: String , variant: String ) {
Firebase.analytics. logEvent ( "experiment_viewed" ) { .. . }
}
}
// 2. Initialize Stringboot
StringProvider. initialize (
context = this ,
cacheSize = 1000 ,
analyticsHandler = analyticsHandler,
providedDeviceId = "USER_ID" // Optional: Custom User ID
)
// 3. Initialize FAQ Provider
FAQProvider. initialize (
context = this ,
cacheSize = 200
)
// 4. Configure Logging (Debug builds only)
if (BuildConfig.DEBUG) {
StringbootLogger.logLevel = StringbootLogger.Level.DEBUG
}
// 5. Trigger Initial Sync
CoroutineScope (Dispatchers.IO). launch {
StringProvider. refreshFromNetwork (StringProvider. deviceLocale ())
FAQProvider. refreshFromNetwork ()
}
}
}
This single initialization block sets up the core SDK. Uncomment the specific lines to enable A/B Testing tracking or custom logging.
Next Steps
Now that you’ve installed the SDK, learn how to use it in your app.
Basic Usage Fetch strings and update your UI