Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  
Summary:[Ctors](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#pubctors)\|[Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#inhmethods)  

# CustomAudience.Builder

`
public
static
final

class
CustomAudience.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|----------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.adservices.customaudience.CustomAudience.Builder |

<br />

*** ** * ** ***

Builder for[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)objects.

## Summary

|                                                                  ### Public constructors                                                                   ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#Builder())`() ` |

|                                                                                                                                                                                                                                                                                                                     ### Public methods                                                                                                                                                                                                                                                                                                                     ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)                 | ` `[build](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#build())`() ` Builds an instance of a[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience).                                                                                                                                                                                  |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setActivationTime](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setActivationTime(java.time.Instant))`(`[Instant](https://developer.android.com/reference/java/time/Instant)` activationTime) ` Sets the time, truncated to milliseconds, after which the[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)will serve ads.    |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setAds](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setAds(java.util.List<android.adservices.common.AdData>))`(`[List](https://developer.android.com/reference/java/util/List)`<`[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)`> ads) ` Sets the initial remarketing ads served by the custom audience.                                         |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setBiddingLogicUri](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setBiddingLogicUri(android.net.Uri))`(`[Uri](https://developer.android.com/reference/android/net/Uri)` biddingLogicUri) ` Sets the URI to fetch bidding logic from for use in the ad selection process.                                                                                                                                        |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setBuyer](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setBuyer(android.adservices.common.AdTechIdentifier))`(`[AdTechIdentifier](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdTechIdentifier)` buyer) ` Sets the buyer[AdTechIdentifier](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdTechIdentifier).       |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setDailyUpdateUri](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setDailyUpdateUri(android.net.Uri))`(`[Uri](https://developer.android.com/reference/android/net/Uri)` dailyUpdateUri) ` Sets the daily update URI.                                                                                                                                                                                              |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setExpirationTime](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setExpirationTime(java.time.Instant))`(`[Instant](https://developer.android.com/reference/java/time/Instant)` expirationTime) ` Sets the time, truncated to milliseconds, after which the[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)should be removed. |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setName](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` name) ` Sets the[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)object's name.                                                                                       |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setTrustedBiddingData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setTrustedBiddingData(android.adservices.customaudience.TrustedBiddingData))`(`[TrustedBiddingData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/TrustedBiddingData)` trustedBiddingData) ` Sets the trusted bidding data to be queried and used in the ad selection process.        |
| ` `[CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | ` `[setUserBiddingSignals](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder#setUserBiddingSignals(android.adservices.common.AdSelectionSignals))`(`[AdSelectionSignals](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdSelectionSignals)` userBiddingSignals) ` Sets the user bidding signals used in the ad selection process.                                          |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public Builder ()
```

<br />

<br />

## Public methods

### build

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience build ()
```

Builds an instance of a[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience).

<br />

|                                                                                 Returns                                                                                  ||
|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience) | This value cannot be`null`. <br /> |

|                                                                            Throws                                                                             ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)         | if any non-null parameter is null                     |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the expiration time occurs before activation time  |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the expiration time is set before the current time |

### setActivationTime

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setActivationTime (Instant activationTime)
```

Sets the time, truncated to milliseconds, after which the[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)will serve ads.

Set to`null`in order for this[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)to be immediately active and participate in ad selection.

See[CustomAudience.getActivationTime()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getActivationTime())for more information.

<br />

|                          Parameters                          ||
|------------------|--------------------------------------------|
| `activationTime` | `Instant`: This value may be`null`. <br /> |

|                                                                           Returns                                                                            ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | <br /> |

### setAds

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setAds (List<AdData> ads)
```

Sets the initial remarketing ads served by the custom audience. Will be assigned with an empty list if not provided.

See[CustomAudience.getAds()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getAds())for more information.

<br />

|                   Parameters                   ||
|-------|-----------------------------------------|
| `ads` | `List`: This value may be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |

### setBiddingLogicUri

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setBiddingLogicUri (Uri biddingLogicUri)
```

Sets the URI to fetch bidding logic from for use in the ad selection process. The URI must use HTTPS.

See[CustomAudience.getBiddingLogicUri()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getBiddingLogicUri())for more information.

<br />

|                          Parameters                          ||
|-------------------|-------------------------------------------|
| `biddingLogicUri` | `Uri`: This value cannot be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |

### setBuyer

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setBuyer (AdTechIdentifier buyer)
```

Sets the buyer[AdTechIdentifier](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdTechIdentifier).

See[CustomAudience.getBuyer()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getBuyer())for more information.

<br />

|                           Parameters                            ||
|---------|--------------------------------------------------------|
| `buyer` | `AdTechIdentifier`: This value cannot be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |

### setDailyUpdateUri

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setDailyUpdateUri (Uri dailyUpdateUri)
```

Sets the daily update URI. The URI must use HTTPS.

See[CustomAudience.getDailyUpdateUri()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getDailyUpdateUri())for more information.

<br />

|                         Parameters                          ||
|------------------|-------------------------------------------|
| `dailyUpdateUri` | `Uri`: This value cannot be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |

### setExpirationTime

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setExpirationTime (Instant expirationTime)
```

Sets the time, truncated to milliseconds, after which the[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)should be removed.

See[CustomAudience.getExpirationTime()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getExpirationTime())for more information.

<br />

|                          Parameters                          ||
|------------------|--------------------------------------------|
| `expirationTime` | `Instant`: This value may be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |

### setName

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setName (String name)
```

Sets the[CustomAudience](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience)object's name.

See[CustomAudience.getName()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getName())for more information.

<br />

|                      Parameters                      ||
|--------|----------------------------------------------|
| `name` | `String`: This value cannot be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |

### setTrustedBiddingData

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setTrustedBiddingData (TrustedBiddingData trustedBiddingData)
```

Sets the trusted bidding data to be queried and used in the ad selection process.

See[CustomAudience.getTrustedBiddingData()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getTrustedBiddingData())for more information.

<br />

|                                 Parameters                                  ||
|----------------------|-------------------------------------------------------|
| `trustedBiddingData` | `TrustedBiddingData`: This value may be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |

### setUserBiddingSignals

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public CustomAudience.Builder setUserBiddingSignals (AdSelectionSignals userBiddingSignals)
```

Sets the user bidding signals used in the ad selection process.

See[CustomAudience.getUserBiddingSignals()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience#getUserBiddingSignals())for more information.

<br />

|                                 Parameters                                  ||
|----------------------|-------------------------------------------------------|
| `userBiddingSignals` | `AdSelectionSignals`: This value may be`null`. <br /> |

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [CustomAudience.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/customaudience/CustomAudience.Builder) | This value cannot be`null`. <br /> |