GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

BlazePlayerCustomActionButtonParams Android

BlazePlayerCustomActionButtonParams

The BlazePlayerCustomActionButtonParams data class contains identifying information and appMetadata
for custom action buttons in the Blaze Players.

This data class helps track and manage custom buttons by providing a unique identifier and
additional contextual information that can be used when handling button interactions.

id

var id: String

A unique identifier for the custom action button.

This identifier can be used to track interactions with the button or to retrieve
the button from a collection of buttons.

name

var name: String

The name of the custom action button.

appMetadata

var appMetadata: Map<String, Any>

Additional appMetadata associated with the custom action button.

Use this map to store any relevant information that should be associated with
the button, such as analytics event names, feature flags, or other contextual data
that might be needed when handling button interactions.

sdkMetadata

var sdkMetadata: @RawValue MutableMap<String, Any>

Additional metadata managed by the SDK.

  • Note: Do not attempt to modify this property directly. It is managed by the SDK.

Visibility Condition

visibilityCondition - property

var visibilityCondition: VisibilityCondition?

The visibility condition that determines when this button should be shown.

Example Usage:

// Show button only when playerId exists (using preset method)
visibilityCondition = BlazeExtraInfoKeyPreset.PLAYER_ID.exists()
     
// Show button only for specific team (using preset method)
visibilityCondition = BlazeExtraInfoKeyPreset.TEAM_ID.equalsTo("team123")
     
// Show button only for live content (using preset method)
// Note: metadata values are strings, so use "true" for boolean comparison
visibilityCondition = BlazeExtraInfoKeyPreset.IS_CURRENTLY_LIVE.equalsTo("true")
     
// Show button for specific games or seasons (using preset methods)
 visibilityCondition = VisibilityCondition.Or(listOf(
     BlazeExtraInfoKeyPreset.GAME_ID.equalsTo("game456"),
     BlazeExtraInfoKeyPreset.SEASON_ID.equalsTo("season2024")
     ))
     
// Complex conditions with AND/OR logic (using preset methods)
visibilityCondition = VisibilityCondition.And(listOf(
     BlazeExtraInfoKeyPreset.PLAYER_ID.exists(),
     VisibilityCondition.Or(listOf(
         BlazeExtraInfoKeyPreset.TEAM_ID.equalsTo("team123"),
         BlazeExtraInfoKeyPreset.IS_CURRENTLY_LIVE.equalsTo("true")
         ))
     ))

// Using raw strings for custom keys
visibilityCondition = VisibilityCondition.And(listOf(
     VisibilityCondition.KeyExists("customKey"),
     VisibilityCondition.KeyEqualsTo("anotherCustomKey", "customValue")
     ))

Sealed class - VisibilityCondition

OptionsValuesDescription
alwaysButton is always visible
neverButton is never visible
keyExistsval key: StringButton is visible when the specified metadata key exists
keyNotExistsval key: StringButton is visible when the specified metadata key does not exist
keyEqualsval key: String, val value: @RawValue AnyButton is visible when the metadata key equals the specified value
keyNotEqualsval key: String, val value: @RawValue AnyButton is visible when the metadata key does not equal the specified value
keyInval key: String, val values: @RawValue List AnyButton is visible when the metadata key's value is in the specified array
keyNotInval key: String, val values: @RawValue List AnyButton is visible when the metadata key's value is not in the specified array
keyGreaterThanval key: String, val threshold: DoubleButton is visible when the numeric metadata value is greater than the threshold
keyLessThanval key: String, val threshold: DoubleButton is visible when the numeric metadata value is less than the threshold
keyBetweenval key: String, val min: Double, val max: DoubleButton is visible when the numeric metadata value is between the specified range (inclusive)
keyContainsval key: String, val substring: StringButton is visible when the string metadata value contains the specified substring
andval conditions: List VisibilityConditionButton is visible when ALL of the specified conditions are true
orval conditions: List VisibilityConditionButton is visible when ANY of the specified conditions are true
notval condition: VisibilityConditionButton is visible when the specified condition is NOT true

Convenient Preset Methods

exists

fun BlazeExtraInfoKeyPreset.exists(): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this metadata key exists.

  • Returns: A visibility condition that evaluates to true when the key exists

Example:

// Check if playerId exists
visibilityCondition = BlazeExtraInfoKeyPreset.PLAYER_ID.exists()

notExists

fun BlazeExtraInfoKeyPreset.notExists(): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this metadata key does not exist.

  • Returns: A visibility condition that evaluates to true when the key does not exist

Example:

// Check if playerId does not exist
visibilityCondition = BlazeExtraInfoKeyPreset.PLAYER_ID.notExists()

equals

fun BlazeExtraInfoKeyPreset.equalsTo(value: Any): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this metadata key equals a specific value.

  • Parameter value: The value to compare against
  • Returns: A visibility condition that evaluates to true when the key equals the value

Example:

 // Check if teamId equals "team123"
visibilityCondition = BlazeExtraInfoKeyPreset.TEAM_ID.equalsTo("team123")

// Check if isCurrentlyLive equals true (metadata values are strings)
visibilityCondition = BlazeExtraInfoKeyPreset.IS_CURRENTLY_LIVE.equalsTo("true")

notEquals

fun BlazeExtraInfoKeyPreset.notEqualsTo(value: Any): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this metadata key does not equal a specific value.

  • Parameter value: The value to compare against
  • Returns: A visibility condition that evaluates to true when the key does not equal the value

Example:

// Check if teamId is not "team123"
visibilityCondition = BlazeExtraInfoKeyPreset.TEAM_ID.notEqualsTo("team123")

isIn

fun BlazeExtraInfoKeyPreset.isIn(values: List<Any>): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this metadata key's value is in a specified array.

  • Parameter values: The array of values to check membership
  • Returns: A visibility condition that evaluates to true when the key's value is in the array

Example:

// Check if playerId is one of specific players
visibilityCondition = BlazeExtraInfoKeyPreset.PLAYER_ID.isIn(listOf("player1", "player2", "player3"))
 
// Check if teamId is one of specific teams
visibilityCondition = BlazeExtraInfoKeyPreset.TEAM_ID.isIn(listOf("team123", "team456"))

isNotIn

fun BlazeExtraInfoKeyPreset.isNotIn(values: List<Any>): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this metadata key's value is not in a specified array.

  • Parameter values: The array of values to check membership
  • Returns: A visibility condition that evaluates to true when the key's value is not in the array

Example:

// Check if playerId is not one of specific players
visibilityCondition = BlazeExtraInfoKeyPreset.PLAYER_ID.isNotIn(listOf("bannedPlayer1", "bannedPlayer2"))

greaterThan

fun BlazeExtraInfoKeyPreset.greaterThan(threshold: Double): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this numeric metadata key's value is greater than a threshold.

  • Parameter threshold: The minimum value (exclusive)
  • Returns: A visibility condition that evaluates to true when the key's value is greater than the threshold

Example:

// Check if some numeric score is greater than 8.0
// Note: metadata "8.5" string will be parsed to 8.5 for comparison
visibilityCondition = customNumericKey.greaterThan(8.0)

lessThan

fun BlazeExtraInfoKeyPreset.lessThan(threshold: Double): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this numeric metadata key's value is less than a threshold.

  • Parameter threshold: The maximum value (exclusive)
  • Returns: A visibility condition that evaluates to true when the key's value is less than the threshold

Example:

// Check if some numeric score is less than 5.0
// Note: metadata "4.2" string will be parsed to 4.2 for comparison
visibilityCondition = customNumericKey.lessThan(5.0)

between

fun BlazeExtraInfoKeyPreset.between(min: Double, max: Double): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this numeric metadata key's value is between two values (inclusive).

  • Parameters:
    • min: The minimum value (inclusive)
    • max: The maximum value (inclusive)
  • Returns: A visibility condition that evaluates to true when the key's value is between min and max

Example:

// Check if some numeric score is between 5.0 and 10.0
// Note: metadata "7.5" string will be parsed to 7.5 for comparison
visibilityCondition = customNumericKey.between(5.0, 10.0)

contains

fun BlazeExtraInfoKeyPreset.contains(substring: String): BlazePlayerCustomActionButtonParams.VisibilityCondition

Creates a condition that checks if this string metadata key's value contains a substring.

  • Parameter substring: The substring to search for
  • Returns: A visibility condition that evaluates to true when the key's value contains the substring

Example:

// Check if activeLabels contains "highlight"
visibilityCondition = BlazeExtraInfoKeyPreset.ACTIVE_LABELS.contains("highlight")


Did this page help you?