KeyedFrequencyCap


class KeyedFrequencyCap : Parcelable
kotlin.Any
   ↳ android.adservices.common.KeyedFrequencyCap

A frequency cap for a specific ad counter key.

Frequency caps define the maximum rate an event can occur within a given time interval. If the frequency cap is exceeded, the associated ad will be filtered out of ad selection.

Summary

Nested classes

Builder for creating KeyedFrequencyCap objects.

Inherited constants
Public methods
Boolean
equals(other: Any?)

Checks whether the KeyedFrequencyCap objects contain the same information.

Int

Returns the ad counter key that the frequency cap is applied to.

Duration

Returns the interval, as a Duration which will be truncated to the nearest second, over which the frequency cap is calculated.

Int

Returns the maximum count of event occurrences allowed within a given time interval.

Int

Returns the hash of the KeyedFrequencyCap object's data.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<KeyedFrequencyCap!>

Public methods

equals

fun equals(other: Any?): Boolean

Checks whether the KeyedFrequencyCap objects contain the same information.

Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getAdCounterKey

fun getAdCounterKey(): Int

Returns the ad counter key that the frequency cap is applied to.

The ad counter key is defined by an adtech and is an arbitrary numeric identifier which defines any criteria which may have previously been counted and persisted on the device. If the on-device count exceeds the maximum count within a certain time interval, the frequency cap has been exceeded.

Return
Int This value cannot be null.

getInterval

fun getInterval(): Duration

Returns the interval, as a Duration which will be truncated to the nearest second, over which the frequency cap is calculated.

When this frequency cap is computed, the number of persisted events is counted in the most recent time interval. If the count of previously occurring matching events for an adtech is greater than the number returned by getMaxCount(), the frequency cap has been exceeded, and the ad will not be eligible for ad selection.

Return
Duration This value cannot be null.

getMaxCount

fun getMaxCount(): Int

Returns the maximum count of event occurrences allowed within a given time interval.

If there are more events matching the ad counter key and ad event type counted on the device within the time interval defined by getInterval(), the frequency cap has been exceeded, and the ad will not be eligible for ad selection.

For example, an ad that specifies a filter for a max count of two within one hour will not be eligible for ad selection if the event has been counted two or more times within the hour preceding the ad selection process.

hashCode

fun hashCode(): Int

Returns the hash of the KeyedFrequencyCap object's data.

Return
Int a hash code value for this object.

toString

fun toString(): String

writeToParcel

fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

static val CREATOR: Parcelable.Creator<KeyedFrequencyCap!>