# ReportUsageRequest.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

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

Builder for[ReportUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest)objects.

## Summary

|                                                                                                                                                                                                                                               Public constructors                                                                                                                                                                                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest.Builder#Builder(kotlin.String,%20kotlin.String))`(`namespace:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `documentId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Creates a new[ReportUsageRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest.Builder#)instance. |

|                                                                                                                                                                                                                                               Public methods                                                                                                                                                                                                                                                ||
|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ReportUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest)                  | [build](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest.Builder#build())`()` Builds a new[ReportUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest).                                                                                                                             |
| [ReportUsageRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest.Builder#) | [setUsageTimestampMillis](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest.Builder#setUsageTimestampMillis(kotlin.Long))`(`usageTimestampMillis:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the timestamp in milliseconds of the usage report (the time at which the document was used). |

## Public constructors

### Builder

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

```
Builder(
    namespace: String, 
    documentId: String)
```

Creates a new[ReportUsageRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest.Builder#)instance.

|                                                                                                                                                                   Parameters                                                                                                                                                                   ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `namespace`  | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The namespace of the document that was used (such as from[android.app.appsearch.GenericDocument#getNamespace](https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument#getNamespace()). This value cannot be`null`. |
| `documentId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The ID of document that was used (such as from[android.app.appsearch.GenericDocument#getId](https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument#getId()). This value cannot be`null`.                          |

## Public methods

### build

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

```
fun build(): ReportUsageRequest
```

Builds a new[ReportUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest).

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

### setUsageTimestampMillis

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

```
fun setUsageTimestampMillis(usageTimestampMillis: Long): ReportUsageRequest.Builder
```

Sets the timestamp in milliseconds of the usage report (the time at which the document was used).

The value is in the[System.currentTimeMillis](https://developer.android.com/reference/kotlin/java/lang/System.html#currentTimeMillis())time base.

If unset, this defaults to the current timestamp at the time that the[ReportUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportUsageRequest)is constructed.

|                                                                                                Parameters                                                                                                 ||
|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `usageTimestampMillis` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. |

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