Class MobileService
-
- All Implemented Interfaces:
public abstract class MobileServiceRepresents the base class for all mobile services, for example, UserService, etc. Each service represents a feature that the mobile app wants to use. To use a service, create an instance of that service, then feed to SDKInitializer to initialize it, then later client code can get the instance from SDKInitializer.
-
-
Field Summary
Fields Modifier and Type Field Description private Applicationapplicationprivate StringapiKey
-
Constructor Summary
Constructors Constructor Description MobileService()
-
Method Summary
Modifier and Type Method Description final ApplicationgetApplication()The application instance final UnitsetApplication(Application application)The application instance final StringgetApiKey()The api key that can connect to mobile server final UnitsetApiKey(String apiKey)The api key that can connect to mobile server UnitenableNetworkPolicy(NetworkPolicy policy)Enable and set network policy for mobile service. final <Error class: unknown class>isApplicationInitialized()Check whether application instance is initialized. Unitinit(Application application, String apiKey)Initializes the mobile service Unitreset()Resets the mobile service to the state that just initialized. UnitonStateChange(ApplicationState state)Notified when application state changes. BooleanmayStartNewProcess()Indicates whether this service might start a process. -
-
Method Detail
-
getApplication
final Application getApplication()
The application instance
-
setApplication
final Unit setApplication(Application application)
The application instance
-
getApiKey
final String getApiKey()
The api key that can connect to mobile server
-
setApiKey
final Unit setApiKey(String apiKey)
The api key that can connect to mobile server
-
enableNetworkPolicy
Unit enableNetworkPolicy(NetworkPolicy policy)
Enable and set network policy for mobile service.
-
isApplicationInitialized
final <Error class: unknown class> isApplicationInitialized()
Check whether application instance is initialized.
-
init
Unit init(Application application, String apiKey)
Initializes the mobile service
-
reset
Unit reset()
Resets the mobile service to the state that just initialized.
-
onStateChange
Unit onStateChange(ApplicationState state)
Notified when application state changes. This function will be called on Main thread.
-
mayStartNewProcess
Boolean mayStartNewProcess()
Indicates whether this service might start a process. For example, Baidu push service has a service to be started in another process, thus we need to initialize the sqlite libraries before starting all the services.
-
-
-
-