public class

ApptimizeOptions

extends Object
java.lang.Object
   ↳ com.apptimize.ApptimizeOptions

Class Overview

Configurable options when making calls to run Apptimize tests.

Summary

Nested Classes
enum ApptimizeOptions.LogLevel

When used as an argument to setLogLevel(com.apptimize.ApptimizeOptions.LogLevel), Apptimize will log all messages of the given importance or higher

 
Public Constructors
ApptimizeOptions()
Public Methods
ApptimizeOptions disableVisualChangesAndThirdPartyEventImport()

Helper function to turn off visual changes (e.g.

boolean doesForceVariantsShowWinnersAndInstantUpdates()
String getDeviceName()
ApptimizeOptions.LogLevel getLogLevel()
Long getUpdateMetaDataTimeout()
boolean isDeveloperModeDisabled()
boolean isExplicitEnablingRequired()
boolean isMultiprocessModeEnabled()
boolean isPerformanceLoggingEnabled()
boolean isRefreshingMetadataOnSetup()
boolean isSetupInBackground()
boolean isThirdPartyEventExportingEnabled()
boolean isThirdPartyEventImportingEnabled()
boolean isVisualChangesEnabled()
ApptimizeOptions setDeveloperModeDisabled(boolean developerModeDisabled)

A device in developer mode can be connected to the Apptimize dashboard in order to create visual variants and metrics or try out different variants in real-time.

ApptimizeOptions setDeviceName(String deviceName)

Set the name of the device which will appear when connecting to the Visual Apptimizer.

ApptimizeOptions setExplicitEnablingRequired(boolean explicitEnablingRequired)

By default, this is set to false, in which case visual variants and metrics (which can be setup through the Visual Apptimizer) are allowed on any android.app.Activity.

ApptimizeOptions setForceVariantsShowWinnersAndInstantUpdates(boolean showWinnersAndInstantUpdates)

Controls the display of winners and instant updates while forced variables are active.

ApptimizeOptions setIsRefreshingMetadataOnSetup(boolean refreshMetadataOnSetup)

Normally Apptimize will use cached metadata on setup and only checks for metadata after a certain amount of time has passed since this last check.

ApptimizeOptions setLogLevel(ApptimizeOptions.LogLevel logLevel)

Allows you to tune Apptimize's log level.

ApptimizeOptions setMultiprocessMode(boolean multiprocessMode)

Allows Apptimize to run in every process of an app with multiple processes.

ApptimizeOptions setPerformanceLoggingEnabled(boolean enabled)

Turns on performance logging for Apptimize.

ApptimizeOptions setThirdPartyEventExportingEnabled(boolean enabled)

Allows Apptimize to export events to 3rd party analytics services.

ApptimizeOptions setThirdPartyEventImportingEnabled(boolean enabled)

Allows Apptimize to import 3rd party analytics events.

ApptimizeOptions setUpdateMetadataTimeout(long updateMetadataTimeout)

Setting this option indicates to Apptimize that it is okay to wait for the specified amount of time to receive the first metadata update.

ApptimizeOptions setVisualChangesEnabled(boolean enabled)

Allows Apptimize for visual changes (e.g.

ApptimizeOptions setupInBackground(boolean setupInBackground)

Apptimize.setup() should normally be called and run on the main thread, to ensure that all of the Apptimize functionality is available immediately.

[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ApptimizeOptions ()

Public Methods

public ApptimizeOptions disableVisualChangesAndThirdPartyEventImport ()

Helper function to turn off visual changes (e.g. hotfixes and visual experiments) and automatic third-party event imports.

Also see setVisualChangesEnabled(boolean) and setThirdPartyEventImportingEnabled(boolean)

Returns
  • This ApptimizeOptions object

public boolean doesForceVariantsShowWinnersAndInstantUpdates ()

public String getDeviceName ()

public ApptimizeOptions.LogLevel getLogLevel ()

public Long getUpdateMetaDataTimeout ()

public boolean isDeveloperModeDisabled ()

public boolean isExplicitEnablingRequired ()

public boolean isMultiprocessModeEnabled ()

public boolean isPerformanceLoggingEnabled ()

public boolean isRefreshingMetadataOnSetup ()

public boolean isSetupInBackground ()

public boolean isThirdPartyEventExportingEnabled ()

public boolean isThirdPartyEventImportingEnabled ()

public boolean isVisualChangesEnabled ()

public ApptimizeOptions setDeveloperModeDisabled (boolean developerModeDisabled)

A device in developer mode can be connected to the Apptimize dashboard in order to create visual variants and metrics or try out different variants in real-time.

By default, Apptimize will put a device into developer mode if the app is debug-signed. Setting this option to true will override this behavior, causing the device to never connect to the Apptimize dashboard.

Parameters
developerModeDisabled Whether developer mode should be disabled
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setDeviceName (String deviceName)

Set the name of the device which will appear when connecting to the Visual Apptimizer. If null, Apptimize will generate a name based on the device model and a random unique identifier.

Parameters
deviceName The device name, or null
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setExplicitEnablingRequired (boolean explicitEnablingRequired)

By default, this is set to false, in which case visual variants and metrics (which can be setup through the Visual Apptimizer) are allowed on any android.app.Activity.

If you set this option to true, visual variants and metrics will only be allowed for an android.app.Activity if you have explicitly enabled it by annotating it with ApptimizeExplicitlyEnabled.

Parameters
explicitEnablingRequired Whether visual variants and metrics should only be allowed when explicitly enabled for an android.app.Activity.
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setForceVariantsShowWinnersAndInstantUpdates (boolean showWinnersAndInstantUpdates)

Controls the display of winners and instant updates while forced variables are active.

See Apptimize#forceVariant

Parameters
showWinnersAndInstantUpdates True to show winners and instant updates while forced variants are active
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setIsRefreshingMetadataOnSetup (boolean refreshMetadataOnSetup)

Normally Apptimize will use cached metadata on setup and only checks for metadata after a certain amount of time has passed since this last check. This happens automatically in the background. Setting this option will force the check to happen at setup regardless of the age. Additionally, if setUpdateMetadataTimeout(long) has been set then apptimize will also wait on the result of the refresh.

Note: Metadata will not be available, even if it is cached, until after the check is completed when this option is specified.

Parameters
refreshMetadataOnSetup True to force a refresh of metadata during Apptimize setup.
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setLogLevel (ApptimizeOptions.LogLevel logLevel)

Allows you to tune Apptimize's log level. By default, Apptimize contains a moderate amount of logging about its operations such as reporting when a user is enrolled in experiments. With this option, you can limit Apptimize to only log errors and exceptional circumstances. Note that you will still be able to view the Apptimize logs through the Advanced Verify feature on the Apptimize dashboard. By default, this is set to LogLevel.VERBOSE.

Parameters
logLevel A ApptimizeOptions.LogLevel specifying that Apptimize will only output log messages of importance logLevel or higher
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setMultiprocessMode (boolean multiprocessMode)

Allows Apptimize to run in every process of an app with multiple processes. If most of your app is in one process, and you only need to test in that process, you do not need to use this option. You should only use this option if your app is split across multiple Android proccesses. Very few apps will need to use this option, as Google itself recommends against designing apps this way (see official documentation). Use of this option comes with some performance penalty, due to the increased synchronization required.

Parameters
multiprocessMode Whether Apptimize should be allowed to run in multiple processes, thereby requiring additional synchronization
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setPerformanceLoggingEnabled (boolean enabled)

Turns on performance logging for Apptimize. This will log key metrics related to startup and test timings to a file called apptimizePublicTimingLog.txt in your app's data directory.

Parameters
enabled Whether Apptimize should log out performance metrics to a file
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setThirdPartyEventExportingEnabled (boolean enabled)

Allows Apptimize to export events to 3rd party analytics services.

Parameters
enabled defaults to true. Set to false to prevent automatic exporting of our events to 3rd party analytics services.
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setThirdPartyEventImportingEnabled (boolean enabled)

Allows Apptimize to import 3rd party analytics events.

Parameters
enabled defaults to true. Set to false to prevent automatic importing of other 3rd party analytic events.
Returns
  • This ApptimizeOptions object

public ApptimizeOptions setUpdateMetadataTimeout (long updateMetadataTimeout)

Setting this option indicates to Apptimize that it is okay to wait for the specified amount of time to receive the first metadata update. If not set, Apptimize will not wait.

Apptimize receives metadata that indicates whether this device is allocated to any currently running A/B tests and, if so, which variant of each test the device is allocated to. Methods like runTest(String, ApptimizeTest, ApptimizeOptions) or stringForTest(String, String, ApptimizeOptions) behave differently depending on which tests the device belongs to. If these methods are run before Apptimize has received its first metadata update, since Apptimize cannot determine if the user is allocated to the test, it will fall back to the default behavior and assume the user is not allocated to the test.

Setting this option indicates that in this scenario, Apptimize should wait the specified amount of time to receive the first metadata update. This option is especially useful if you will be calling methods like runTest(String, ApptimizeTest, ApptimizeOptions) or stringForTest(String, String, ApptimizeOptions) soon after you have called setup(android.content.Context, String).

Note that updateMetadataTimeout is a maximum, in milliseconds, of the amount of time we are willing to wait. As soon as Apptimize receives metadata, it will stop waiting. If Apptimize has already received metadata in the past, it will not wait at all. The parameter will be capped at a maximum value of 5000 (i.e., 5 seconds). If updateMetadataTimeout is set to the special values of 0 or negative numbers, Apptimize will use the maximum value of 5000 (i.e., 5 seconds)

Parameters
updateMetadataTimeout The maximum amount of time, in milliseconds, that Apptimize is allowed to wait for the initial metadata.
Returns
  • This ApptimizeOptions object.

public ApptimizeOptions setVisualChangesEnabled (boolean enabled)

Allows Apptimize for visual changes (e.g. hotfixes and visual experiments).

Parameters
enabled defaults to true. Set to false to disable visual changes.

Returns
  • This ApptimizeOptions object

public ApptimizeOptions setupInBackground (boolean setupInBackground)

Apptimize.setup() should normally be called and run on the main thread, to ensure that all of the Apptimize functionality is available immediately. In particular, importing 3rd-party events requires Apptimize.setup() to complete. To improve your app's startup performance, you may choose to have setup functionality run on a background thread. If you call options.setupInBackground(true) then Apptimize.setup(...options) will start a background thread and return immediately. Importing of 3rd-party events will not be operational until this background-setup-task completes. If your app calls an Apptimize method that requires setup to have completed, the calling thread will block until the background-setup-task completes

Parameters
setupInBackground Whether setup should be in a background thread
Returns
  • This ApptimizeOptions object