Package es.situm.sdk

Class Configuration


  • public class Configuration
    extends Object
    Set the configuration of the the Situm SDK: user credentials, dashboard url, cache expiration, etc.
    • Method Detail

      • setApiKey

        public boolean setApiKey​(@NonNull
                                 String email,
                                 @NonNull
                                 String apiKey)
        Provides your API key to the Situm SDK for Android. This key is generated for your application in the Dashboard. Old credentials will be removed.
        Parameters:
        email - email that identifies the account. Can't be empty.
        apiKey - key obtained at situm.es. Can't be empty
        Returns:
        true if operation finished successfully, otherwise false
        Throws:
        IllegalArgumentException - if email or apiKey are null or empty
      • setUserPass

        public boolean setUserPass​(@NonNull
                                   String email,
                                   @NonNull
                                   String password)
        Provides user's email and password. This credentials will be used to obtain a valid user token to authenticate the server request, when necessary. Token obtaining is not necessary done when this method is executed. Old credentials will be removed.
        Parameters:
        email - user's email. Can't be empty.
        password - user's password. Can't be empty.
        Returns:
        true if operation finished successfully, otherwise false
        Throws:
        IllegalArgumentException - if email or password are null or empty
      • allowInvalidSSLCertificate

        public boolean allowInvalidSSLCertificate​(boolean allowInvalidSSLCertificate)
        Tell the system to trust the SSL certificate of the server (even though the Authority is not valid).
        This should not be used in production unless you really don't care about the security. Use at your own risk.
        Parameters:
        allowInvalidSSLCertificate - if true, communications with the server may not be secure
        Returns:
        true if operation finished successfully, otherwise false
      • isAllowInvalidSSLCertificate

        public boolean isAllowInvalidSSLCertificate()
        Returns true if all SSL certificates are trusted
        Returns:
        if true, the SDK will trust all SSL certificates and the communication with the server may not be secure
      • getDashboardURL

        @NonNull
        public String getDashboardURL()
        Obtains the currently Dashboard url used
        Returns:
        url used by the SDK
      • setDashboardURL

        public void setDashboardURL​(@NonNull
                                    String url)
        Set the Dashboard URL used by the SDK
        Parameters:
        url - the new Dashboard url. It will do nothing if is null.
      • getCacheMaxAge

        public long getCacheMaxAge()
        Get the maximum age of a cached response.
        Returns:
        age of the cached response in milliseconds
      • setCacheMaxAge

        public boolean setCacheMaxAge​(long maxAge,
                                      @NonNull
                                      TimeUnit timeUnit)
        Sets the maximum age of a cached response. If the cache response's age exceeds maxAge, it will not be used and a network request will be made.
        Parameters:
        maxAge - a non-negative integer
        Returns:
        true if operation finished successfully, otherwise false
        Throws:
        IllegalArgumentException - if timeUnit is null or maxAge is less than zero
      • setUseRemoteConfig

        public void setUseRemoteConfig​(boolean useRemoteConfig)
        Set to true if you want the SDK to download the configuration from dashboard and use it by default. Right now it only affects the LocationRequest. Default value is false but it may change in the future
        Parameters:
        useRemoteConfig -
      • isUseRemoteConfig

        public boolean isUseRemoteConfig()