Class MobileService
-
- All Implemented Interfaces:
public abstract class MobileService
Represents 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 Application
application
private String
apiKey
-
Constructor Summary
Constructors Constructor Description MobileService()
-
Method Summary
Modifier and Type Method Description final Application
getApplication()
The application instance final Unit
setApplication(Application application)
The application instance final String
getApiKey()
The api key that can connect to mobile server final Unit
setApiKey(String apiKey)
The api key that can connect to mobile server Unit
enableNetworkPolicy(NetworkPolicy policy)
Enable and set network policy for mobile service. final Boolean
isApplicationInitialized()
Check whether application instance is initialized. Unit
init(Application application, String apiKey)
Initializes the mobile service Unit
reset()
Resets the mobile service to the state that just initialized. Unit
onStateChange(ApplicationState state)
Notified when application state changes. Boolean
mayStartNewProcess()
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 Boolean 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.
-
-
-
-