Package es.situm.sdk

Class Configuration


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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allowInvalidSSLCertificate​(boolean allowInvalidSSLCertificate)
      Tell the system to trust the SSL certificate of the server (even though the Authority is not valid).
      java.lang.String currentEmailAccount()
      Return user email of credentials previously provided with setApiKey(String, String), setUserPass(String, String) or declared in the Android Manifest
      long getCacheMaxAge()
      Get the maximum age of a cached response.
      java.lang.String getDashboardURL()
      Obtains the currently Dashboard url used
      java.lang.String getLanguage()  
      boolean getUseExternalLocaltions()  
      boolean isAllowInvalidSSLCertificate()
      Returns true if all SSL certificates are trusted
      boolean isUseRemoteConfig()  
      boolean setApiKey​(java.lang.String email, java.lang.String apiKey)
      Provides your API key to the Situm SDK for Android.
      boolean setCacheMaxAge​(long maxAge, java.util.concurrent.TimeUnit timeUnit)
      Sets the maximum age of a cached response.
      void setDashboardURL​(java.lang.String url)
      Set the Dashboard URL used by the SDK
      void setLanguage​(java.lang.String language)
      Set the language code you want the names of your cartography to be translated to.
      void setLanguageFromSystem​(android.content.Context context)
      Calls setLanguage(String) using the current phone language.
      void setUseRemoteConfig​(boolean useRemoteConfig)
      Set to true if you want the SDK to download the configuration from dashboard and use it by default.
      boolean setUserPass​(java.lang.String email, java.lang.String password)
      Provides user's email and password.
      void useExternalLocations​(boolean useExternalLocaltions)
      Set to true if you want the SDK to use external locations instead of it's own indoor positioning system.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setApiKey

        public boolean setApiKey​(@NonNull
                                 java.lang.String email,
                                 @NonNull
                                 java.lang.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.com. Can't be empty
        Returns:
        true if operation finished successfully, otherwise false
        Throws:
        java.lang.IllegalArgumentException - if email or apiKey are null or empty
      • currentEmailAccount

        @Nullable
        public java.lang.String currentEmailAccount()
        Return user email of credentials previously provided with setApiKey(String, String), setUserPass(String, String) or declared in the Android Manifest
        Returns:
        null if SDK has no credentials, current email otherwise.
      • setUserPass

        public boolean setUserPass​(@NonNull
                                   java.lang.String email,
                                   @NonNull
                                   java.lang.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:
        java.lang.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 java.lang.String getDashboardURL()
        Obtains the currently Dashboard url used
        Returns:
        url used by the SDK
      • setDashboardURL

        public void setDashboardURL​(@NonNull
                                    java.lang.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​(@IntRange(from=0L)
                                      long maxAge,
                                      @NonNull
                                      java.util.concurrent.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:
        java.lang.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 true from SDK version 2.83.5
        Parameters:
        useRemoteConfig -
      • isUseRemoteConfig

        public boolean isUseRemoteConfig()
      • useExternalLocations

        public void useExternalLocations​(boolean useExternalLocaltions)
        Set to true if you want the SDK to use external locations instead of it's own indoor positioning system. This mode will only work in Building Mode. Default value is false.
        Parameters:
        useExternalLocaltions -
      • getUseExternalLocaltions

        public boolean getUseExternalLocaltions()
      • setLanguage

        public void setLanguage​(java.lang.String language)
        Set the language code you want the names of your cartography to be translated to. This will only apply if you have them configured in the dashboard. If there is no translation to the language you put here the default value will be the one the sdk will use.

        Defaults to empty so the SDK will not use any language preference.

        Parameters:
        language - The language code with just two characters, if there's more like for example en_US the three last characters will be ignored.
      • setLanguageFromSystem

        public void setLanguageFromSystem​(android.content.Context context)
        Calls setLanguage(String) using the current phone language.
        Parameters:
        context - Current context.
        See Also:
        setLanguage(String)
      • getLanguage

        public java.lang.String getLanguage()