Class FlurryConfig

java.lang.Object
com.flurry.android.FlurryConfig

public final class FlurryConfig extends Object
This is the main entry point for the Flurry Config API. Access and initialize an instance by calling getInstance().

The Flurry Config allows you to enable the ability to change the functionality of an app after it has shipped without a new mobile app code push, and enables you to deliver different content to different users.

See Also:
  • Method Details

    • getInstance

      public static FlurryConfig getInstance()
      Gets a FlurryConfig instance to access and initialize the Flurry Config APIs.
      Returns:
      The FlurryConfig instance.
    • fetchConfig

      public void fetchConfig()
      Fetch Config will trigger an async call to the server. Server has a throttle where when the user calls fetchConfig many times in a row, it will basically do a no-op. If we do go out to server, once we return we should store this value onto disk, to be picked up during initialization the next time around.
    • activateConfig

      public boolean activateConfig()
      Activate Config attempts to apply the most recent config. activateConfig returns a boolean value based on whether or not the config was applied. activateConfig will return false if there is no new config data.
      Returns:
      true if a newly fetched data is activated.
    • resetState

      public void resetState()
      Clear out cached config data on disk.
    • registerListener

      public void registerListener(@NonNull FlurryConfigListener configListener)
      Register a listener for the state of fetching. Multiple listeners can be passed in and each one will be called in the order they are registered. Notification will be post on the main thread.
      Parameters:
      configListener - Callback listener to be registered
    • registerListener

      public void registerListener(@NonNull FlurryConfigListener configListener, @NonNull android.os.Handler handler)
      Register a listener for the state of fetching. Multiple listeners can be passed in and each one will be called in the order they are registered. User specified handler can be assigned to post the notification.
      Parameters:
      configListener - Callback listener to be registered
      handler - The notification handler
    • unregisterListener

      public void unregisterListener(@NonNull FlurryConfigListener configListener)
      Unregister a callback listener
      Parameters:
      configListener - Callback listener to be removed
    • getString

      public String getString(@NonNull String key, @Nullable String defaultValue)
      Retrieves a String value from the configuration.
      Parameters:
      key - The name of the configuration to retrieve.
      defaultValue - Value to return if this configuration does not exist.
      Returns:
      The configuration value if it exists, or defaultValue.
    • getBoolean

      public boolean getBoolean(@NonNull String key, boolean defaultValue)
      Retrieves a boolean value from the configuration. The boolean returned represents the value true if the configuration value is not null and is equal, ignoring case, to the string "true". This method has the same parsing scheme as Boolean.parseBoolean(String).
      Parameters:
      key - The name of the configuration to retrieve.
      defaultValue - Value to return if this configuration does not exist.
      Returns:
      The configuration value if it exists, or defaultValue.
    • getInt

      public int getInt(@NonNull String key, int defaultValue)
      Retrieves a int value from the configuration. This method has the same parsing scheme as Integer.decode(String).
      Parameters:
      key - The name of the configuration to retrieve.
      defaultValue - Value to return if this configuration does not exist.
      Returns:
      The configuration value if it exists, or defaultValue.
    • getLong

      public long getLong(@NonNull String key, long defaultValue)
      Retrieves a long value from the configuration. This method has the same parsing scheme as Long.decode(String).
      Parameters:
      key - The name of the configuration to retrieve.
      defaultValue - Value to return if this configuration does not exist.
      Returns:
      The configuration value if it exists, or defaultValue.
    • getDouble

      public double getDouble(@NonNull String key, double defaultValue)
      Retrieves a double value from the configuration. This method has the same parsing scheme as Double.parseDouble(String).
      Parameters:
      key - The name of the configuration to retrieve.
      defaultValue - Value to return if this configuration does not exist.
      Returns:
      The configuration value if it exists, or defaultValue.
    • getFloat

      public float getFloat(@NonNull String key, float defaultValue)
      Retrieves a float value from the configuration. This method has the same parsing scheme as Float.parseFloat(String).
      Parameters:
      key - The name of the configuration to retrieve.
      defaultValue - Value to return if this configuration does not exist.
      Returns:
      The configuration value if it exists, or defaultValue.
    • toString

      public String toString()
      Get current config data info; it's a synchronized call waiting for cache loading, do not get during init.
      Overrides:
      toString in class Object