init

fun init(context: Context, appId: String)

Initialize the SDK with the default SwanConfig (production backend, debug logs off).

Parameters

context

application or activity context — only applicationContext is retained.

appId

tenant identifier (becomes ?appId= on every wire call).

Returns synchronously. Device registration runs asynchronously; observe registrationState or register an addInitializedListener to wait for completion if you need it. Repeat calls with the same arguments are no-ops.


fun init(context: Context, appId: String, config: SwanConfig)

Initialize the SDK.

Parameters

context

application or activity context — only applicationContext is retained.

appId

tenant identifier (becomes ?appId= on every wire call).

config

SwanConfig (debug, production, push, location knobs).

Returns synchronously. Device registration runs asynchronously; observe registrationState or register an addInitializedListener to wait for completion if you need it. Repeat calls with the same arguments are no-ops.

Validation: appId is not empty-checked here. An empty appId will surface on the wire as ?appId=, which the backend rejects; surfacing the error there gives the host app a clearer diagnostic than silently swallowing it.