Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder class to create a ProfilingTrigger
object.
Summary
Public constructors |
Create a new builder instance to create a ProfilingTrigger object.
|
Public constructors
Builder
Builder(triggerType: Int)
Create a new builder instance to create a ProfilingTrigger
object. Requires a trigger type. An app can only have one registered trigger per trigger type. Adding a new trigger with the same type will override the previously set one.
Exceptions |
java.lang.IllegalArgumentException |
if the trigger type is not valid. |
Public methods
setRateLimitingPeriodHours
fun setRateLimitingPeriodHours(rateLimitingPeriodHours: Int): ProfilingTrigger.Builder
Set a rate limiting period in hours. The period is the minimum time the system should wait before providing another profiling result for the same trigger; actual time between events may be longer. If the rate limiting period is not provided or set to 0, no app-provided rate limiting will be used. This rate limiting is in addition to any system level rate limiting that may be applied.
Exceptions |
java.lang.IllegalArgumentException |
if the value is less than 0. |
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-08-20 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-08-20 UTC."],[],[],null,["# ProfilingTrigger.Builder\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/os/ProfilingTrigger.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.os.ProfilingTrigger.Builder](#) |\n\nBuilder class to create a [ProfilingTrigger](/reference/kotlin/android/os/ProfilingTrigger) object.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(kotlin.Int))`(`triggerType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Create a new builder instance to create a [ProfilingTrigger](/reference/kotlin/android/os/ProfilingTrigger) object. |\n\n| Public methods ||\n|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ProfilingTrigger](/reference/kotlin/android/os/ProfilingTrigger) | [build](#build())`()` Build the [ProfilingTrigger](/reference/kotlin/android/os/ProfilingTrigger) object. |\n| [ProfilingTrigger.Builder](#) | [setRateLimitingPeriodHours](#setRateLimitingPeriodHours(kotlin.Int))`(`rateLimitingPeriodHours:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set a rate limiting period in hours. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(triggerType: Int)\n```\n\nCreate a new builder instance to create a [ProfilingTrigger](/reference/kotlin/android/os/ProfilingTrigger) object. Requires a trigger type. An app can only have one registered trigger per trigger type. Adding a new trigger with the same type will override the previously set one.\n\n| Parameters ||\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `triggerType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is [android.os.ProfilingTrigger#TRIGGER_TYPE_NONE](/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_NONE:kotlin.Int), [android.os.ProfilingTrigger#TRIGGER_TYPE_APP_FULLY_DRAWN](/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_APP_FULLY_DRAWN:kotlin.Int), [android.os.ProfilingTrigger#TRIGGER_TYPE_ANR](/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_ANR:kotlin.Int), [android.os.ProfilingTrigger#TRIGGER_TYPE_APP_REQUEST_RUNNING_TRACE](/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_APP_REQUEST_RUNNING_TRACE:kotlin.Int), [android.os.ProfilingTrigger#TRIGGER_TYPE_KILL_FORCE_STOP](/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_KILL_FORCE_STOP:kotlin.Int), [android.os.ProfilingTrigger#TRIGGER_TYPE_KILL_RECENTS](/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_KILL_RECENTS:kotlin.Int), or [android.os.ProfilingTrigger#TRIGGER_TYPE_KILL_TASK_MANAGER](/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_KILL_TASK_MANAGER:kotlin.Int) |\n\n| Exceptions ||\n|--------------------------------------|-----------------------------------|\n| `java.lang.IllegalArgumentException` | if the trigger type is not valid. |\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): ProfilingTrigger\n```\n\nBuild the [ProfilingTrigger](/reference/kotlin/android/os/ProfilingTrigger) object.\n\n| Return ||\n|-------------------------------------------------------------------|------------------------------|\n| [ProfilingTrigger](/reference/kotlin/android/os/ProfilingTrigger) | This value cannot be `null`. |\n\n### setRateLimitingPeriodHours\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setRateLimitingPeriodHours(rateLimitingPeriodHours: Int): ProfilingTrigger.Builder\n```\n\nSet a rate limiting period in hours. The period is the minimum time the system should wait before providing another profiling result for the same trigger; actual time between events may be longer. If the rate limiting period is not provided or set to 0, no app-provided rate limiting will be used. This rate limiting is in addition to any system level rate limiting that may be applied.\n\n| Return ||\n|-------------------------------|------------------------------|\n| [ProfilingTrigger.Builder](#) | This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|------------------------------|\n| `java.lang.IllegalArgumentException` | if the value is less than 0. |"]]