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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Application application
      private String apiKey
    • Constructor Summary

      Constructors 
      Constructor Description
      MobileService()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MobileService

        MobileService()
    • 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

      • 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.