SDKInitializer

Represents the utility to initialize MobileService used by the mobile app when starting the app. Usually start function should be called in 'onCreate' of your Application.

Properties

Link copied to clipboard
var apiKey: String?
Link copied to clipboard
var pubKey: String?

Functions

Link copied to clipboard
fun <T : MobileService> getService(clazz: KClass<T>): T?

Retrieves the enabled service by the given clazz, 'null' will be returned if no such a service is found.

Link copied to clipboard
@JvmStatic
fun getServices(): List<MobileService>

Retrieves the service list

Link copied to clipboard

Initializes a service after SDKInitializer is initialized.

Link copied to clipboard

Notifies the services about the new client policy retrieved from the server.

Link copied to clipboard
@VisibleForTesting
fun reset()

Internal for testing

Link copied to clipboard
fun resetServices(resetHandler: (s: MobileService) -> Boolean? = null)

Resets all services. resetHandler is where client code injects its own logic to reset a service. If either client code handles the reset of certain service, or wants to ignore the reset of it, the resetHandler can return 'true' for that service, otherwise, the default reset logic will be used.

Link copied to clipboard
@JvmOverloads
@JvmStatic
fun start(application: Application, vararg services: MobileService, apiKey: String? = null, pubKey: String? = null)

Starts the application with the services. The instance of each service will be notified with the application states at different occasions, then they can execute their logic according to the state.