Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
A builder for TrainingInterval
Summary
Public constructors
Public methods
build
fun build(): TrainingInterval
Builds the instance. This builder should not be touched after calling this!
setMinimumInterval
fun setMinimumInterval(value: Duration): TrainingInterval.Builder
Sets the minimum time interval between two training runs.
This field will only be used when the scheduling mode is SCHEDULING_MODE_RECURRENT
. Only positive values are accepted, zero or negative values will result in IllegalArgumentException.
Please also note this value is advisory, which does not guarantee the job will be run immediately after the interval expired. Federated compute will still enforce a minimum required interval and training constraints to ensure system health. The current training constraints are device on unmetered network, idle and battery not low.
Parameters |
value |
Duration: This value cannot be null . |
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,["# TrainingInterval.Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/adservices/ondevicepersonalization/TrainingInterval.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.ondevicepersonalization.TrainingInterval.Builder](#) |\n\nA builder for [TrainingInterval](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval)\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [TrainingInterval](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval) | [build](#build())`()` Builds the instance. |\n| [TrainingInterval.Builder](#) | [setMinimumInterval](#setMinimumInterval(java.time.Duration))`(`value:` `[Duration](../../../java/time/Duration.html#)`)` Sets the minimum time interval between two training runs. |\n| [TrainingInterval.Builder](#) | [setSchedulingMode](#setSchedulingMode(kotlin.Int))`(`value:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` The scheduling mode for this task, either [SCHEDULING_MODE_ONE_TIME](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_ONE_TIME:kotlin.Int) or [SCHEDULING_MODE_RECURRENT](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_RECURRENT:kotlin.Int). |\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) \n\n```\nBuilder()\n```\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) \n\n```\nfun build(): TrainingInterval\n```\n\nBuilds the instance. This builder should not be touched after calling this!\n\n| Return ||\n|---------------------------------------------------------------------------------------------------|------------------------------|\n| [TrainingInterval](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval) | This value cannot be `null`. |\n\n### setMinimumInterval\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setMinimumInterval(value: Duration): TrainingInterval.Builder\n```\n\nSets the minimum time interval between two training runs.\n\nThis field will only be used when the scheduling mode is [SCHEDULING_MODE_RECURRENT](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_RECURRENT:kotlin.Int). Only positive values are accepted, zero or negative values will result in IllegalArgumentException.\n\nPlease also note this value is advisory, which does not guarantee the job will be run immediately after the interval expired. Federated compute will still enforce a minimum required interval and training constraints to ensure system health. The current training constraints are device on unmetered network, idle and battery not low.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------|\n| `value` | [Duration](../../../java/time/Duration.html#): This value cannot be `null`. |\n\n| Return ||\n|-------------------------------|------------------------------|\n| [TrainingInterval.Builder](#) | This value cannot be `null`. |\n\n### setSchedulingMode\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setSchedulingMode(value: Int): TrainingInterval.Builder\n```\n\nThe scheduling mode for this task, either [SCHEDULING_MODE_ONE_TIME](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_ONE_TIME:kotlin.Int) or [SCHEDULING_MODE_RECURRENT](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_RECURRENT:kotlin.Int). The default scheduling mode is [SCHEDULING_MODE_ONE_TIME](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_ONE_TIME:kotlin.Int) if unspecified.\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is [android.adservices.ondevicepersonalization.TrainingInterval#SCHEDULING_MODE_ONE_TIME](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_ONE_TIME:kotlin.Int), or [android.adservices.ondevicepersonalization.TrainingInterval#SCHEDULING_MODE_RECURRENT](/reference/kotlin/android/adservices/ondevicepersonalization/TrainingInterval#SCHEDULING_MODE_RECURRENT:kotlin.Int) |\n\n| Return ||\n|-------------------------------|------------------------------|\n| [TrainingInterval.Builder](#) | This value cannot be `null`. |"]]