Production guide
This guide summarizes recommendations for using Tolgee Android SDK in production.
Over‑the‑air (OTA) updates & caching
- CDN: Configure your CDN URL prefix and a stable path per project/environment.
- Caching: Use
TolgeeStorageProviderAndroid(context, BuildConfig.VERSION_CODE)
so cache invalidates on app updates. - Offline behavior: SDK serves cached values when offline; provide static fallbacks where needed.
Tolgee.init {
contentDelivery {
url = "https://cdn.tolg.ee/your-cdn-url-prefix"
storage = TolgeeStorageProviderAndroid(appContext, BuildConfig.VERSION_CODE)
}
}
Formatting mode (Sprintf vs ICU)
- Sprintf: Natural when your source data comes from Android XML (
%s
,%d
, plurals). - ICU: Use when your data uses Tolgee Universal ICU placeholders.
Tolgee.init {
contentDelivery {
// Default is Sprintf for Android-style placeholders
format(Tolgee.Formatter.Sprintf)
// Or switch to ICU:
// format(Tolgee.Formatter.ICU)
}
}
See also: Android XML format · Tolgee Universal ICU placeholders
Preloading & startup
- Preload critical namespaces/locales on splash or application init.
- Defer non-critical content until after first frame to keep startup fast.
- Show fallback strings while loading.
Environments
- Use separate CDN prefixes for dev/staging/prod.
- Verify cache busting between releases (via
BuildConfig.VERSION_CODE
).
Error handling
- Log fetch failures and fall back to cache/static values.
- Consider retry/backoff for transient network errors.
Security & networking
- Add only required domains in your
network_security.xml
. - For self-hosting, ensure TLS and set correct domain(s). See Self‑hosting.
Testing
- Provide test doubles for content delivery to return deterministic values.
- For UI tests, inject a test Tolgee instance with preloaded data.