Object SDKInitializer
-
- All Implemented Interfaces:
public class SDKInitializerRepresents 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.
-
-
Field Summary
Fields Modifier and Type Field Description private final StringapiKeyprivate final StringpubKeypublic final static SDKInitializerINSTANCE
-
Method Summary
Modifier and Type Method Description final static Unitstart(Application application, MobileService services, String apiKey, String pubKey)Starts the application with the services. final static Unitstart(Application application, MobileService services, String apiKey)Starts the application with the services. final static Unitstart(Application application, MobileService services)Starts the application with the services. final <T extends MobileService> TgetService(KClass<T> clazz)Retrieves the enabled service by the given clazz, 'null' will be returned if no such a service is found. final UnitinitializeService(MobileService service)Initializes a service after SDKInitializer is initialized. final UnitresetServices(Function1<MobileService, Boolean> resetHandler)Resets all services. final UnitnotifyClientPoliciesRetrieved(ClientPolicies policy)Notifies the services about the new client policy retrieved from the server. final static List<MobileService>getServices()Retrieves the service list final Unitreset()Internal for testing final StringgetApiKey()final StringgetPubKey()-
-
Method Detail
-
start
@JvmOverloads() final static Unit start(Application application, MobileService services, String apiKey, String pubKey)
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.
-
start
@JvmOverloads() final static Unit start(Application application, MobileService services, String apiKey)
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.
-
start
@JvmOverloads() final static Unit start(Application application, MobileService services)
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.
-
getService
final <T extends MobileService> T getService(KClass<T> clazz)
Retrieves the enabled service by the given clazz, 'null' will be returned if no such a service is found.
-
initializeService
final Unit initializeService(MobileService service)
Initializes a service after SDKInitializer is initialized.
- Parameters:
service- the service to start.
-
resetServices
final Unit resetServices(Function1<MobileService, Boolean> resetHandler)
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.
-
notifyClientPoliciesRetrieved
final Unit notifyClientPoliciesRetrieved(ClientPolicies policy)
Notifies the services about the new client policy retrieved from the server.
-
getServices
final static List<MobileService> getServices()
Retrieves the service list
-
reset
@VisibleForTesting() final Unit reset()
Internal for testing
-
getApiKey
final String getApiKey()
-
getPubKey
final String getPubKey()
-
-
-
-