Most apps need only a new dependency version and a new token. Your cached strings, FAQs and Device-ID survive the upgrade.
1. Update the dependency
Upgrade from 1.x straight to 2.1.0:Check your dependencies
SDK 2.0 brings fewer libraries into your app. If your app used any of these only because the SDK pulled them in, declare them in your ownbuild.gradle.kts:
- Retrofit
- Material 3, Compose runtime and Compose Material 3
- WorkManager
androidx.activity:activity-ktxandroidx.lifecycle:lifecycle-viewmodel
androidx.lifecycle:lifecycle-process and androidx.compose.ui:ui-text. You don’t need to add any permissions or ProGuard rules for it.
2. Use a Client Token
SDK 2.0 authenticates with your App’s Client Token (sb_...), which travels in the URL path. There is no X-API-Token header any more. Create a Client Token in the dashboard (see API Tokens) and put it in the manifest:
401: the SDK then stops syncing and keeps serving cached strings until it’s initialized again with a valid token.
Set com.stringboot.api_url to https://api.stringboot.com (a leftover /api/v1 suffix is ignored).
3. Update your code
Most apps need no code changes. Check these:Upgrading from 2.0.x to 2.1.0
- Automatic sync. 2.1.0 syncs at start-up and on returning to the foreground by itself. Apps that already call
sync()orstartAutoRefresh()need no changes; the SDK shares concurrent syncs, so there are no extra requests. To keep the 2.0.x behaviour, passautoSync = falsetoinitializeor setcom.stringboot.auto_synctofalsein the manifest. - Token changes. Switching to a different Client Token or base URL now keeps the previously stored strings until the new configuration succeeds. 2.0.x discarded them right away.
- Libraries. A library compiled against 2.0.x that calls
StringProvider.initializewith default arguments must be recompiled against 2.1.0.
Experiments
The server no longer assigns variants or records anything. The SDK buckets each Device from the Catalog with the same function the server used, so Devices keep their variants.StringbootAnalyticsHandler.onExperimentsAssigned keeps its signature. To log exposures, add a StringbootExposureListener. See A/B Testing.
onExperimentsAssigned is now called when assignments change, and once with an empty map when the last experiment stops. Make sure your analytics code handles an empty map.Default locale
com.stringboot.default_locale no longer overrides the language the user chose on every start. The saved language is restored before the first sync.
4. Certificate pinning
SDK 2.0 ships new built-in pins forcom.stringboot.enable_ssl_pinning; nothing to do for them. If you copied pins into your own network_security_config.xml, replace them with the current pin-set from Troubleshooting: the old pins fail TLS.
What happens to installed apps
On the first launch after the upgrade:- Cached data. Cached strings and FAQs are kept, so the app works offline right away. The first successful sync replaces them.
- Device-ID. The existing Device-ID is kept and now sent on every request.
Checklist
- Dependency is
2.1.0or later -
com.stringboot.api_tokenholds a Client Token starting withsb_ -
com.stringboot.api_urlishttps://api.stringboot.com - Analytics code handles an empty assignments map
- Pins copied into your own network security config (if any) are updated
- A fresh install shows your strings, and an edit in the dashboard appears within about two minutes