Skip to Content
PlatformsAndroidConfiguration

Configuration

Android’s initialize(context, completion) takes no options object — unlike Web’s init(apiKey, options), there’s nothing to pass beyond a Context. Everything else is either read from the manifest, set via a dedicated method before/after initialize(), or comes from the server.

API key

Read from AndroidManifest.xml’s <meta-data android:name="app.onesygnal.API_KEY" ...> entry (ManifestConfig.API_KEY_META_DATA_NAME), or overridden in code:

OneSygnal.setApiKey("YOUR_API_KEY")
  • Must be called before initialize(). The key is resolved once, at initialize() time (apiKeyOverride ?: ManifestConfig.readApiKey(context)); calling setApiKey() afterward is a silent no-op.
  • A blank key is also a silent no-op — it leaves any prior override (or the manifest value) in place rather than throwing.
  • If the resolved key is null (neither a manifest entry nor an override), initialize() doesn’t throw — its completion resolves false. See Troubleshooting.

API host

Not configurable by integrators at all. It’s compiled into the SDK binary as BuildConfig.DEFAULT_API_HOST, defaulting to https://sdk-api.1sygnal.app. (SDK developers can point a local build at a different host via onesygnal.apiHost in a gitignored local.properties, but that’s a build-time setting for developing this SDK, not something a consuming app can change.)

Locale

Defaults to the device’s locale (Locale.getDefault().toLanguageTag()) at initialize() time. Override with:

OneSygnal.setLocale("fr-FR")

Unlike setApiKey(), this is live-reactive: calling it after initialize() immediately updates the Accept-Language header used for subsequent requests and triggers a fresh config/surveys fetch under the new locale — no app restart needed. Called before initialize(), it just sets the locale that call will use.

Surveys enabled

OneSygnal.setSurveysEnabled(false) OneSygnal.areSurveysEnabled() // Boolean, default true

Both work whether or not initialize() has run yet — surveysEnabled is a plain in-memory flag checked by track(), not something that requires the SDK to be initialized.

Server-controlled settings

These are not integrator-configurable — they come from the project’s SDK config, fetched during initialize(). Defaults below apply only if that fetch hasn’t happened yet or returns nothing:

SettingDefaultNotes
globalCooldownMinutes1440Minimum gap between any two surveys shown to the same user.
dailyCap3Max surveys per user per day.
sessionTimeout1800 (seconds)Inactivity gap after which SessionTracker fires a new session_start.
eventsPerSecond10.0RateLimiter token-bucket refill rate.
eventsBurstLimit100.0RateLimiter token-bucket max/burst size.

What’s present here but absent on Web

reset(), setApiKey(), and setLocale() all exist on Android (and iOS) but not on Web:

  • reset() — clears the identified user and mints a new anonymous ID. Web has never drawn this distinction.
  • setApiKey() — Web takes the key as init()’s argument instead, so there’s no override method to mirror.
  • setLocale() — Web’s locale is fixed at init() time by design; Android’s is live-reactive.

See the full Platform Parity table for every operation.