# ProfilingTrigger.Builder

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/os/ProfilingTrigger.Builder "View this page in Java")  

```
class Builder
```

|---|----------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                             ||
| ↳ | [android.os.ProfilingTrigger.Builder](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger.Builder#) |

Builder class to create a[ProfilingTrigger](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger)object.

## Summary

|                                                                                                                                                                        Public constructors                                                                                                                                                                         ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger.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](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger)object. |

|                                                                                                                                                                                                      Public methods                                                                                                                                                                                                      ||
|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ProfilingTrigger](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger)                  | [build](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger.Builder#build())`()` Build the[ProfilingTrigger](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger)object.                                                                                  |
| [ProfilingTrigger.Builder](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger.Builder#) | [setRateLimitingPeriodHours](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger.Builder#setRateLimitingPeriodHours(kotlin.Int))`(`rateLimitingPeriodHours:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set a rate limiting period in hours. |

## Public constructors

### Builder

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(triggerType: Int)
```

Create a new builder instance to create a[ProfilingTrigger](https://developer.android.com/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.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ||
|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `triggerType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.os.ProfilingTrigger#TRIGGER_TYPE_NONE](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_NONE:kotlin.Int),[android.os.ProfilingTrigger#TRIGGER_TYPE_APP_FULLY_DRAWN](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_APP_FULLY_DRAWN:kotlin.Int),[android.os.ProfilingTrigger#TRIGGER_TYPE_ANR](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_ANR:kotlin.Int),[android.os.ProfilingTrigger#TRIGGER_TYPE_APP_REQUEST_RUNNING_TRACE](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_APP_REQUEST_RUNNING_TRACE:kotlin.Int),[android.os.ProfilingTrigger#TRIGGER_TYPE_KILL_FORCE_STOP](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_KILL_FORCE_STOP:kotlin.Int),[android.os.ProfilingTrigger#TRIGGER_TYPE_KILL_RECENTS](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_KILL_RECENTS:kotlin.Int), or[android.os.ProfilingTrigger#TRIGGER_TYPE_KILL_TASK_MANAGER](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger#TRIGGER_TYPE_KILL_TASK_MANAGER:kotlin.Int) |

|                               Exceptions                                ||
|--------------------------------------|-----------------------------------|
| `java.lang.IllegalArgumentException` | if the trigger type is not valid. |

## Public methods

### build

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): ProfilingTrigger
```

Build the[ProfilingTrigger](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger)object.

|                                                           Return                                                            ||
|------------------------------------------------------------------------------------------------|-----------------------------|
| [ProfilingTrigger](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger) | This value cannot be`null`. |

### setRateLimitingPeriodHours

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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.

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ProfilingTrigger.Builder](https://developer.android.com/reference/kotlin/android/os/ProfilingTrigger.Builder#) | This value cannot be`null`. |

|                             Exceptions                             ||
|--------------------------------------|------------------------------|
| `java.lang.IllegalArgumentException` | if the value is less than 0. |