# ReportSystemUsageRequest.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/ReportSystemUsageRequest.Builder "View this page in Java")  

```
class Builder
```

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

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

## Summary

|                                                                                                                                                                                                                                                                                                                                                                          Public constructors                                                                                                                                                                                                                                                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest.Builder#Builder(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.String))`(`packageName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `databaseName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `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[ReportSystemUsageRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest.Builder#)instance. |

|                                                                                                                                                                                                                                                        Public methods                                                                                                                                                                                                                                                         ||
|--------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ReportSystemUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest)                  | [build](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest.Builder#build())`()` Builds a new[ReportSystemUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest).                                                                                                                 |
| [ReportSystemUsageRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest.Builder#) | [setUsageTimestampMillis](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest.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(
    packageName: String, 
    databaseName: String, 
    namespace: String, 
    documentId: String)
```

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

|                                                                                                                                                                    Parameters                                                                                                                                                                    ||
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageName`  | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The package name of the app which owns the document that was used (such as from[SearchResult.getPackageName](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult#getPackageName())). This value cannot be`null`.  |
| `databaseName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The database in which the document that was used resides (such as from[SearchResult.getDatabaseName](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchResult#getDatabaseName())). This value cannot be`null`.         |
| `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(): ReportSystemUsageRequest
```

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

|                                                                         Return                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ReportSystemUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest) | 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): ReportSystemUsageRequest.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[ReportSystemUsageRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest)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                                                                                  ||
|--------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ReportSystemUsageRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/ReportSystemUsageRequest.Builder#) | This value cannot be`null`. |