ImaSdkSettings

public interface ImaSdkSettings


Defines general SDK settings that are used when creating an AdsLoader.

An ImaSdkSettings object should not be modified after an AdsLoader is constructed; however, it can be reused to construct new AdsLoader instances.

See createAdsLoader and createAdsLoader.

Summary

Constants

default static final int

The default maximum number of VAST redirects allowed.

Public methods

abstract boolean

Returns whether VMAP and ad rules ad breaks are automatically played.

abstract Map<StringString>

Returns the feature flags and their states as set by the setFeatureFlags function.

abstract String

Gets the current ISO 639-1 language code.

abstract int

Returns the maximum number of VAST redirects.

abstract @Nullable String

Returns the partner provided player type.

abstract @Nullable String

Returns the partner provided player version.

abstract @Nullable String

Returns the publisher provided ID (PPID) used for tracking.

abstract @Nullable String

Returns the session ID if set.

abstract boolean

Returns whether debug mode is enabled.

abstract void
setAutoPlayAdBreaks(boolean autoPlayAdBreaks)

Sets whether to automatically play VMAP and ad rules ad breaks.

abstract void
setDebugMode(boolean debugMode)

Enables or disables debug mode.

abstract void
setFeatureFlags(Map<StringString> featureFlags)

Sets the feature flags and their states to control experimental features.

abstract void
setLanguage(String language)

Sets the preferred language for the ad UI.

abstract void
setMaxRedirects(int maxRedirects)

Specifies the maximum number of redirects before the subsequent redirects are denied and the ad load aborted.

abstract void
setPlayerType(String playerType)

Sets the partner provided player type.

abstract void
setPlayerVersion(String playerVersion)

Sets the partner provided player version.

abstract void

Sets the publisher provided ID used for tracking.

abstract void
setSessionId(String sessionId)

Sets a temporary session ID used for frequency capping.

abstract String

Returns a string representation of this ImaSdkSettings.

Constants

DEFAULT_MAX_REDIRECTS

default static final int DEFAULT_MAX_REDIRECTS = 4

The default maximum number of VAST redirects allowed.

Public methods

getAutoPlayAdBreaks

abstract boolean getAutoPlayAdBreaks()

Returns whether VMAP and ad rules ad breaks are automatically played.

Default is true.

getFeatureFlags

abstract Map<StringStringgetFeatureFlags()

Returns the feature flags and their states as set by the setFeatureFlags function.

getLanguage

abstract String getLanguage()

Gets the current ISO 639-1 language code. Defaults to "en" for English.

getMaxRedirects

abstract int getMaxRedirects()

Returns the maximum number of VAST redirects.

Also see setMaxRedirects.

getPlayerType

abstract @Nullable String getPlayerType()

Returns the partner provided player type.

Returns
@Nullable String

{String} Partner player type.

getPlayerVersion

abstract @Nullable String getPlayerVersion()

Returns the partner provided player version.

Returns
@Nullable String

{String} Partner player version.

getPpid

abstract @Nullable String getPpid()

Returns the publisher provided ID (PPID) used for tracking.

getSessionId

abstract @Nullable String getSessionId()

Returns the session ID if set.

Returns
@Nullable String

{String} The session ID.

isDebugMode

abstract boolean isDebugMode()

Returns whether debug mode is enabled.

Default is false.

setAutoPlayAdBreaks

abstract void setAutoPlayAdBreaks(boolean autoPlayAdBreaks)

Sets whether to automatically play VMAP and ad rules ad breaks.

Parameters
boolean autoPlayAdBreaks

whether to automatically play ad breaks

setDebugMode

abstract void setDebugMode(boolean debugMode)

Enables or disables debug mode. Debug mode is disabled by default.

Parameters
boolean debugMode

whether to enable debug mode

setFeatureFlags

abstract void setFeatureFlags(Map<StringString> featureFlags)

Sets the feature flags and their states to control experimental features.

This should be set as early as possible, before requesting ads. Settings remain constant until the next ad request. Calling this method again resets any feature flags for the next ad request.

setLanguage

abstract void setLanguage(String language)

Sets the preferred language for the ad UI.

You can find the supported codes in Localization and are closely related to the two-letter ISO 639-1 language codes. If invalid or unsupported, the language defaults to "en" for English. After you create the AdsLoader object, using this setter has no effect.

Parameters
String language

the language code to set.

setMaxRedirects

abstract void setMaxRedirects(int maxRedirects)

Specifies the maximum number of redirects before the subsequent redirects are denied and the ad load aborted.

In this case, the ad raises an error with error code 302. The number of redirects directly affects latency and thus user experience. This applies to all VAST wrapper ads. The default is DEFAULT_MAX_REDIRECTS.

Parameters
int maxRedirects

the maximum number of redirects to allow.

setPlayerType

abstract void setPlayerType(String playerType)

Sets the partner provided player type.

Specifies the name of the player integrated with the SDK to improve analytics. Provide a short, unique identifier. The IMA SDK truncates player type strings longer than 20 characters.

Example:

settings.setPlayerType("google/gmf-player");
Parameters
String playerType

{String} The type of the partner player.

setPlayerVersion

abstract void setPlayerVersion(String playerVersion)

Sets the partner provided player version.

Specifies the version of the partner player integrated with the SDK. Tracks player version usage to improve SDK usability and analytics. The IMA SDK truncates player version strings longer than 20 characters

Example:

settings.setPlayerVersion("1.0.0");
Parameters
String playerVersion

{String} The version of the partner player.

setPpid

abstract void setPpid(String ppid)

Sets the publisher provided ID used for tracking.

Parameters
String ppid

the ppid to set.

setSessionId

abstract void setSessionId(String sessionId)

Sets a temporary session ID used for frequency capping. The session ID must be a UUID, or an empty string if the SDK should not send a session ID.

Parameters
String sessionId

a temporary UUID used for frequency capping

toString

abstract String toString()

Returns a string representation of this ImaSdkSettings.