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, or overridden in code:

OneSygnal.setApiKey("YOUR_API_KEY")
  • Must be called before initialize(). The key is resolved once, at initialize() time; 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, defaulting to https://sdk-api.1sygnal.app.

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.

Debug logging

The Android SDK logs diagnostics via android.util.Log. During development, filter Logcat for the OneSygnal tag to see SDK lifecycle events, trigger evaluations, and network requests.

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.