# ContentRecommendation.Builder

# ContentRecommendation.Builder

Artifact:[androidx.recommendation:recommendation](https://developer.android.com/jetpack/androidx/releases/recommendation)  
[View Source](https://cs.android.com/search?q=file:androidx/recommendation/app/ContentRecommendation.java+class:androidx.recommendation.app.ContentRecommendation.Builder)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)

*** ** * ** ***

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

<br />

```
class ContentRecommendation.Builder
```

<br />

*** ** * ** ***

Builder class for[ContentRecommendation](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation)objects. Provides a convenient way to set the various fields of a[ContentRecommendation](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation).

Example:  

```kotlin
ContentRecommendation rec = new ContentRecommendation.Builder()
        .setIdInfo(id, "MyTagId")
        .setTitle("My Content Recommendation")
        .setText("An example of content recommendation")
        .setContentImage(myBitmap)
        .setBadgeIcon(R.drawable.app_icon)
        .setGroup("Trending")
        .build();
```

## Summary

|                                                                   ### Public constructors                                                                   |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#Builder())`()` Constructs a new Builder. |

|                                                             ### Public functions                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ContentRecommendation](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation)`!`                 | [build](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#build())`()` Combine all of the options that have been set and return a new[ContentRecommendation](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation)object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setAutoDismiss](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setAutoDismiss(boolean))`(autoDismiss: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Sets the flag indicating if the recommendation should be dismissed automatically.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setBackgroundImageUri](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setBackgroundImageUri(java.lang.String))`(imageUri: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Sets the Content URI that will be used to retrieve the background image for the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setBadgeIcon](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setBadgeIcon(int))`(iconResourceId: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the resource ID for the recommendation badging icon.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setColor](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setColor(int))`(color: @`[ColorInt](https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the accent color value to be used in the UI when displaying this content recommendation to the user.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setContentImage](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setContentImage(android.graphics.Bitmap))`(image: `[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html)`!)` Sets the recommendation image.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setContentIntentData](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setContentIntentData(int,android.content.Intent,int,android.os.Bundle))`(` ` @`[ContentRecommendation.IntentType](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.IntentType)` intentType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` intent: `[Intent](https://developer.android.com/reference/android/content/Intent.html)`!,` ` requestCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` options: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?` `)` Sets the data for the Intent that will be issued when the user clicks on the recommendation.                                         |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setContentTypes](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setContentTypes(java.lang.String[]))`(types: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!)` Sets the content types associated with the content recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setDismissIntentData](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setDismissIntentData(int,android.content.Intent,int,android.os.Bundle))`(` ` @`[ContentRecommendation.IntentType](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.IntentType)` intentType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` intent: `[Intent](https://developer.android.com/reference/android/content/Intent.html)`?,` ` requestCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` options: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?` `)` Sets the data for the Intent that will be issued when the recommendation gets dismissed from the Home Screen, due to an user action. |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setGenres](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setGenres(java.lang.String[]))`(genres: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!)` Sets the content genres for the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setGroup](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setGroup(java.lang.String))`(groupTag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Sets the String group ID tag for the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setIdTag](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setIdTag(java.lang.String))`(idTag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Sets the Id tag that uniquely identifies this recommendation object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setMaturityRating](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setMaturityRating(java.lang.String))`(` ` @`[ContentRecommendation.ContentMaturity](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.ContentMaturity)` maturityRating: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` `)` Sets the maturity level rating for the content.                                                                                                                                                                                                                                                                                                                                                                                            |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setPricingInformation](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setPricingInformation(java.lang.String,java.lang.String))`(` ` @`[ContentRecommendation.ContentPricing](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.ContentPricing)` priceType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` priceValue: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` `)` Sets the pricing and availability information for the recommendation.                                                                                                                                                                                                                                               |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setProgress](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setProgress(int,int))`(max: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, progress: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the progress information for the content pointed to by the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setRunningTime](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setRunningTime(long))`(length: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Sets the running time (when applicable) for the content.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setSortKey](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setSortKey(java.lang.String))`(sortKey: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Sets the String sort key for the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setSourceName](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setSourceName(java.lang.String))`(source: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Sets the source application name for the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setStatus](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setStatus(int))`(@`[ContentRecommendation.ContentStatus](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.ContentStatus)` contentStatus: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the availability status for the content.                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setText](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setText(java.lang.String))`(description: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Sets the description text for the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | [setTitle](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder#setTitle(java.lang.String))`(title: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Sets the content title for the recommendation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

## Public constructors

### Builder

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
Builder()
```

Constructs a new Builder.  

## Public functions

### build

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun build(): ContentRecommendation!
```

Combine all of the options that have been set and return a new[ContentRecommendation](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation)object.  

### setAutoDismiss

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setAutoDismiss(autoDismiss: Boolean): ContentRecommendation.Builder!
```

Sets the flag indicating if the recommendation should be dismissed automatically.

Auto-dismiss notifications are automatically removed from the Home Screen when the user clicks on them.  

|                                             Parameters                                             |
|----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
| `autoDismiss: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | A boolean indicating if the recommendation should be auto dismissed or not. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setBackgroundImageUri

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setBackgroundImageUri(imageUri: String?): ContentRecommendation.Builder!
```

Sets the Content URI that will be used to retrieve the background image for the recommendation.  

|                                            Parameters                                            |
|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
| `imageUri: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | A Content URI pointing to the recommendation background image. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setBadgeIcon

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setBadgeIcon(iconResourceId: @DrawableRes Int): ContentRecommendation.Builder!
```

Sets the resource ID for the recommendation badging icon.

The resource id represents the icon resource in the source application package. If not set, or an invalid resource ID is specified, the application icon retrieved from its package will be used by default.  

|                                                                                           Parameters                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| `iconResourceId: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | An integer id for the badge icon resource. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setColor

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setColor(color: @ColorInt Int): ContentRecommendation.Builder!
```

Sets the accent color value to be used in the UI when displaying this content recommendation to the user.  

|                                                                                   Parameters                                                                                    |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| `color: @`[ColorInt](https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | An integer value representing the accent color for this recommendation. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setContentImage

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setContentImage(image: Bitmap!): ContentRecommendation.Builder!
```

Sets the recommendation image.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|-----------------------------------------------|
| `image: `[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html)`!` | A Bitmap containing the recommendation image. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setContentIntentData

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setContentIntentData(
    @ContentRecommendation.IntentType intentType: Int,
    intent: Intent!,
    requestCode: Int,
    options: Bundle?
): ContentRecommendation.Builder!
```

Sets the data for the Intent that will be issued when the user clicks on the recommendation.

The Intent data fields provided correspond to the fields passed into the[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)factory methods, when creating a new PendingIntent. The actual PengindIntent object will only be created at the time a recommendation is posted to the Home Screen.  

|                                                                                                                  Parameters                                                                                                                  |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[ContentRecommendation.IntentType](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.IntentType)` intentType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The type of[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)to be created when posting this recommendation. |
| `intent: `[Intent](https://developer.android.com/reference/android/content/Intent.html)`!`                                                                                                                                                   | The Intent which to be issued when the recommendation is clicked on.                                                                              |
| `requestCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                   | The private request code to be used when creating the[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)      |
| `options: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                                                                                       | Only used for the Activity Intent type. Additional options for how the Activity should be started. May be null if there are no options.           |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setContentTypes

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setContentTypes(types: Array<String!>!): ContentRecommendation.Builder!
```

Sets the content types associated with the content recommendation. The first tag entry will be considered the primary type for the content and will be used for ranking purposes. Other secondary type tags may be provided, if applicable, and may be used for filtering purposes.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
| `types: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!` | Array of predefined type tags (see the`CONTENT_TYPE_*`constants) that describe the recommended content. |

### setDismissIntentData

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setDismissIntentData(
    @ContentRecommendation.IntentType intentType: Int,
    intent: Intent?,
    requestCode: Int,
    options: Bundle?
): ContentRecommendation.Builder!
```

Sets the data for the Intent that will be issued when the recommendation gets dismissed from the Home Screen, due to an user action.

The Intent data fields provided correspond to the fields passed into the[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)factory methods, when creating a new PendingIntent. The actual PengindIntent object will only be created at the time a recommendation is posted to the Home Screen.  

|                                                                                                                  Parameters                                                                                                                  |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[ContentRecommendation.IntentType](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.IntentType)` intentType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The type of[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)to be created when posting this recommendation. |
| `intent: `[Intent](https://developer.android.com/reference/android/content/Intent.html)`?`                                                                                                                                                   | The Intent which gets issued when the recommendation is dismissed from the Home Screen.                                                           |
| `requestCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                   | The private request code to be used when creating the[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)      |
| `options: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                                                                                       | Only used for the Activity Intent type. Additional options for how the Activity should be started. May be null if there are no options.           |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setGenres

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setGenres(genres: Array<String!>!): ContentRecommendation.Builder!
```

Sets the content genres for the recommendation. These genres may be used for content ranking. Genres are open ended String tags.

Some examples: "comedy", "action", "dance", "electronica", "racing", etc.  

|                                                                                     Parameters                                                                                     |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| `genres: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!` | Array of genre string tags that describe the recommended content. |

### setGroup

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setGroup(groupTag: String?): ContentRecommendation.Builder!
```

Sets the String group ID tag for the recommendation.

Recommendations in the same group are ranked by the Home Screen together, and the sort order within a group is respected. This can be useful if the application has different sources for recommendations, like "trending", "subscriptions", and "new music" categories for YouTube, where the user can be more interested in recommendations from one group than another.  

|                                            Parameters                                            |
|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| `groupTag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | A String containing the group ID tag for this recommendation. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setIdTag

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setIdTag(idTag: String!): ContentRecommendation.Builder!
```

Sets the Id tag that uniquely identifies this recommendation object.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|--------------------------------------------------|
| `idTag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | A String tag identifier for this recommendation. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setMaturityRating

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setMaturityRating(
    @ContentRecommendation.ContentMaturity maturityRating: String!
): ContentRecommendation.Builder!
```

Sets the maturity level rating for the content.  

|                                                                                                                             Parameters                                                                                                                              |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[ContentRecommendation.ContentMaturity](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.ContentMaturity)` maturityRating: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | A tag indicating the maturity level rating for the content. This tag must be one of the predefined maturity rating tags (see the`CONTENT_MATURITY_*`constants). |

### setPricingInformation

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setPricingInformation(
    @ContentRecommendation.ContentPricing priceType: String!,
    priceValue: String?
): ContentRecommendation.Builder!
```

Sets the pricing and availability information for the recommendation. The provided information will indicate the access model for the content (free, rental, purchase or subscription) and the price value (if not free).  

|                                                                                                                          Parameters                                                                                                                          |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| `@`[ContentRecommendation.ContentPricing](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.ContentPricing)` priceType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | Pricing type for this content. Must be one of the predefined pricing type tags (see the`CONTENT_PRICING_*`constants). |
| `priceValue: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                                                                                                           | A string containing a representation of the content price in the current locale and currency.                         |

### setProgress

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setProgress(max: Int, progress: Int): ContentRecommendation.Builder!
```

Sets the progress information for the content pointed to by the recommendation.  

|                                       Parameters                                        |
|-----------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| `max: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)      | The maximum value for the progress of this content.                   |
| `progress: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The progress amount for this content. Must be in the range (0 - max). |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setRunningTime

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setRunningTime(length: Long): ContentRecommendation.Builder!
```

Sets the running time (when applicable) for the content.  

|                                       Parameters                                        |
|-----------------------------------------------------------------------------------------|-----------------------------------------------|
| `length: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The running time, in seconds, of the content. |

### setSortKey

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setSortKey(sortKey: String?): ContentRecommendation.Builder!
```

Sets the String sort key for the recommendation.

The sort key must be a String representation of a float number between 0.0 and 1.0, and is used to indicate the relative importance (and sort order) of a single recommendation within its specified group. The recommendations will be ordered in decreasing order of importance within a given group.  

|                                           Parameters                                            |
|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `sortKey: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | A String containing the sort key for this recommendation. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setSourceName

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setSourceName(source: String?): ContentRecommendation.Builder!
```

Sets the source application name for the recommendation.

If the source name is never set, or set to null, the application name retrieved from its package will be used by default.  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| `source: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | A String containing the recommendation source name. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setStatus

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setStatus(@ContentRecommendation.ContentStatus contentStatus: Int): ContentRecommendation.Builder!
```

Sets the availability status for the content. This status indicates whether the referred content is ready to be consumed on the device, or if the user must first purchase, rent, subscribe to, or download the content.  

|                                                                                                                      Parameters                                                                                                                       |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| `@`[ContentRecommendation.ContentStatus](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.ContentStatus)` contentStatus: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The status value for this content. Must be one of the predefined content status values (see the`CONTENT_STATUS_*`constants). |

### setText

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setText(description: String?): ContentRecommendation.Builder!
```

Sets the description text for the recommendation.  

|                                             Parameters                                              |
|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| `description: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | A String containing the recommendation description text. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |

### setTitle

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recommendation#1.0.0)  

```
fun setTitle(title: String!): ContentRecommendation.Builder!
```

Sets the content title for the recommendation.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|-------------------------------------------------------|
| `title: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | A String containing the recommendation content title. |

|                                                                   Returns                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ContentRecommendation.Builder](https://developer.android.com/reference/kotlin/androidx/recommendation/app/ContentRecommendation.Builder)`!` | The Builder object, for chaining. |