Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for creating KeyedFrequencyCap
objects.
Summary
Public constructors
Builder
Builder(
adCounterKey: Int,
maxCount: Int,
interval: Duration)
Parameters |
interval |
Duration: This value cannot be null . |
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# KeyedFrequencyCap.Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/adservices/common/KeyedFrequencyCap.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|----------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.adservices.common.KeyedFrequencyCap.Builder](#) |\n\nBuilder for creating [KeyedFrequencyCap](/reference/kotlin/android/adservices/common/KeyedFrequencyCap) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(kotlin.Int,%20kotlin.Int,%20java.time.Duration))`(`adCounterKey:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `maxCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `interval:` `[Duration](../../../java/time/Duration.html#)`)` \u003cbr /\u003e |\n\n| Public methods ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [KeyedFrequencyCap](/reference/kotlin/android/adservices/common/KeyedFrequencyCap) | [build](#build())`()` Builds and returns a [KeyedFrequencyCap](/reference/kotlin/android/adservices/common/KeyedFrequencyCap) instance. |\n| [KeyedFrequencyCap.Builder](#) | [setAdCounterKey](#setAdCounterKey(kotlin.Int))`(`adCounterKey:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the ad counter key the frequency cap applies to. |\n| [KeyedFrequencyCap.Builder](#) | [setInterval](#setInterval(java.time.Duration))`(`interval:` `[Duration](../../../java/time/Duration.html#)`)` Sets the interval, as a [Duration](../../../java/time/Duration.html#) which will be truncated to the nearest second, over which the frequency cap is calculated. |\n| [KeyedFrequencyCap.Builder](#) | [setMaxCount](#setMaxCount(kotlin.Int))`(`maxCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the maximum count within the time interval for the frequency cap. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions) \n\n```\nBuilder(\n adCounterKey: Int, \n maxCount: Int, \n interval: Duration)\n```\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------|\n| `interval` | [Duration](../../../java/time/Duration.html#): This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions) \n\n```\nfun build(): KeyedFrequencyCap\n```\n\nBuilds and returns a [KeyedFrequencyCap](/reference/kotlin/android/adservices/common/KeyedFrequencyCap) instance.\n\n| Return ||\n|------------------------------------------------------------------------------------|------------------------------|\n| [KeyedFrequencyCap](/reference/kotlin/android/adservices/common/KeyedFrequencyCap) | This value cannot be `null`. |\n\n### setAdCounterKey\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions) \n\n```\nfun setAdCounterKey(adCounterKey: Int): KeyedFrequencyCap.Builder\n```\n\nSets the ad counter key the frequency cap applies to.\n\nSee [getAdCounterKey()](/reference/kotlin/android/adservices/common/KeyedFrequencyCap#getAdCounterKey()) for more information.\n\n| Return ||\n|--------------------------------|------------------------------|\n| [KeyedFrequencyCap.Builder](#) | This value cannot be `null`. |\n\n### setInterval\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions) \n\n```\nfun setInterval(interval: Duration): KeyedFrequencyCap.Builder\n```\n\nSets the interval, as a [Duration](../../../java/time/Duration.html#) which will be truncated to the nearest second, over which the frequency cap is calculated.\n\nSee [getInterval()](/reference/kotlin/android/adservices/common/KeyedFrequencyCap#getInterval()) for more information.\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------|\n| `interval` | [Duration](../../../java/time/Duration.html#): This value cannot be `null`. |\n\n| Return ||\n|--------------------------------|------------------------------|\n| [KeyedFrequencyCap.Builder](#) | This value cannot be `null`. |\n\n### setMaxCount\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions) \n\n```\nfun setMaxCount(maxCount: Int): KeyedFrequencyCap.Builder\n```\n\nSets the maximum count within the time interval for the frequency cap.\n\nSee [getMaxCount()](/reference/kotlin/android/adservices/common/KeyedFrequencyCap#getMaxCount()) for more information.\n\n| Return ||\n|--------------------------------|------------------------------|\n| [KeyedFrequencyCap.Builder](#) | This value cannot be `null`. |"]]