Package com.flurry.android
Class FlurryConfig
java.lang.Object
com.flurry.android.FlurryConfig
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 Summary
Modifier and TypeMethodDescriptionboolean
Activate Config attempts to apply the most recent config.void
Fetch Config will trigger an async call to the server.boolean
getBoolean
(String key, boolean defaultValue) Retrieves a boolean value from the configuration.double
Retrieves a double value from the configuration.float
Retrieves a float value from the configuration.static FlurryConfig
Gets a FlurryConfig instance to access and initialize the Flurry Config APIs.int
Retrieves a int value from the configuration.long
Retrieves a long value from the configuration.Retrieves a String value from the configuration.void
registerListener
(FlurryConfigListener configListener) Register a listener for the state of fetching.void
registerListener
(FlurryConfigListener configListener, android.os.Handler handler) Register a listener for the state of fetching.void
Clear out cached config data on disk.toString()
Get current config data info; it's a synchronized call waiting for cache loading, do not get during init.void
unregisterListener
(FlurryConfigListener configListener) Unregister a callback listener
-
Method Details
-
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
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 registeredhandler
- The notification handler
-
unregisterListener
Unregister a callback listener- Parameters:
configListener
- Callback listener to be removed
-
getString
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
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 asBoolean.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
Retrieves a int value from the configuration. This method has the same parsing scheme asInteger.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
Retrieves a long value from the configuration. This method has the same parsing scheme asLong.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
Retrieves a double value from the configuration. This method has the same parsing scheme asDouble.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
Retrieves a float value from the configuration. This method has the same parsing scheme asFloat.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
Get current config data info; it's a synchronized call waiting for cache loading, do not get during init.
-