# CustomAudience

Artifact: [androidx.privacysandbox.ads:ads-adservices](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/ads/adservices/customaudience/CustomAudience.kt+class:androidx.privacysandbox.ads.adservices.customaudience.CustomAudience) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

*** ** * ** ***


```
public final class CustomAudience
```

<br />

*** ** * ** ***

Represents the information necessary for a custom audience to participate in ad selection.

A custom audience is an abstract grouping of users with similar demonstrated interests. This class is a collection of some data stored on a device that is necessary to serve advertisements targeting a single custom audience.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience.Builder` Builder for `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` objects. |

| ### Constants |
|---|---|
| `static final int` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext14OptIn https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#FLAG_AUCTION_SERVER_REQUEST_DEFAULT() = 0` Default value for auction server request flag. |
| `static final int` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext14OptIn https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#FLAG_AUCTION_SERVER_REQUEST_OMIT_ADS()` This auction server request flag indicates to the service that ads for this Custom Audience can be omitted in the server auction payload. |
| `static final double` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext14OptIn https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#PRIORITY_DEFAULT() = 0.0` Default priority for this custom audience. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#CustomAudience(androidx.privacysandbox.ads.adservices.common.AdTechIdentifier,kotlin.String,android.net.Uri,android.net.Uri,kotlin.collections.List,java.time.Instant,java.time.Instant,androidx.privacysandbox.ads.adservices.common.AdSelectionSignals,androidx.privacysandbox.ads.adservices.customaudience.TrustedBiddingData)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdTechIdentifier buyer, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html dailyUpdateUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html biddingLogicUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData> ads, https://developer.android.com/reference/java/time/Instant.html activationTime, https://developer.android.com/reference/java/time/Instant.html expirationTime, https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdSelectionSignals userBiddingSignals, https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData trustedBiddingSignals )` Represents the information necessary for a custom audience to participate in ad selection. |
| `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext14OptIn https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#CustomAudience(androidx.privacysandbox.ads.adservices.common.AdTechIdentifier,kotlin.String,android.net.Uri,android.net.Uri,kotlin.collections.List,java.time.Instant,java.time.Instant,androidx.privacysandbox.ads.adservices.common.AdSelectionSignals,androidx.privacysandbox.ads.adservices.customaudience.TrustedBiddingData,kotlin.Int,kotlin.Double)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdTechIdentifier buyer, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html dailyUpdateUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html biddingLogicUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData> ads, https://developer.android.com/reference/java/time/Instant.html activationTime, https://developer.android.com/reference/java/time/Instant.html expirationTime, https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdSelectionSignals userBiddingSignals, https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData trustedBiddingSignals, int auctionServerRequestFlags, double priority )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` Checks whether two `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` objects contain the same information. |
| `final https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getActivationTime()()` optional activation time may be set in the future, in order to serve a delayed activation. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData>` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getAds()()` the list of `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` objects is a full and complete list of the ads that will be served by this `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` during the ad selection process. |
| `final int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getAuctionServerRequestFlags()()` the bitfield of auction server request flags. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getBiddingLogicUri()()` the target URI used to fetch bidding logic when a custom audience participates in the ad selection process. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdTechIdentifier` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getBuyer()()` A buyer is identified by a domain in the form "buyerexample.com". |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getDailyUpdateUri()()` a URI that points to a buyer-operated server that hosts updated bidding data and ads metadata to be used in the on-device ad selection process. |
| `final https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getExpirationTime()()` optional expiration time. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getName()()` The custom audience's name is an arbitrary string provided by the owner and buyer on creation of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` object. |
| `final double` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getPriority()()` representing the priority of this custom audience. |
| `final https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getTrustedBiddingSignals()()` optional trusted bidding data, consists of a URI pointing to a trusted server for buyers' bidding data and a list of keys to query the server with. |
| `final https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdSelectionSignals` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#getUserBiddingSignals()()` optional User bidding signals, provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment. |
| `int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#hashCode()()` Returns the hash of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` object's data. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience#toString()()` |

## Constants

### FLAG_AUCTION_SERVER_REQUEST_DEFAULT

```
@ExperimentalFeatures.Ext14OptIn
public static final int FLAG_AUCTION_SERVER_REQUEST_DEFAULT = 0
```

Default value for auction server request flag.

### FLAG_AUCTION_SERVER_REQUEST_OMIT_ADS

```
@ExperimentalFeatures.Ext14OptIn
public static final int FLAG_AUCTION_SERVER_REQUEST_OMIT_ADS
```

This auction server request flag indicates to the service that ads for this Custom Audience can be omitted in the server auction payload.

### PRIORITY_DEFAULT

```
@ExperimentalFeatures.Ext14OptIn
public static final double PRIORITY_DEFAULT = 0.0
```

Default priority for this custom audience.

## Public constructors

### CustomAudience

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

```
public CustomAudience(
    @NonNull AdTechIdentifier buyer,
    @NonNull String name,
    @NonNull Uri dailyUpdateUri,
    @NonNull Uri biddingLogicUri,
    @NonNull List<@NonNull AdData> ads,
    Instant activationTime,
    Instant expirationTime,
    AdSelectionSignals userBiddingSignals,
    TrustedBiddingData trustedBiddingSignals
)
```

Represents the information necessary for a custom audience to participate in ad selection.

A custom audience is an abstract grouping of users with similar demonstrated interests. This class is a collection of some data stored on a device that is necessary to serve advertisements targeting a single custom audience.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdTechIdentifier buyer` | A buyer is identified by a domain in the form "buyerexample.com". |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name` | The custom audience's name is an arbitrary string provided by the owner and buyer on creation of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` object. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html dailyUpdateUri` | a URI that points to a buyer-operated server that hosts updated bidding data and ads metadata to be used in the on-device ad selection process. The URI must use HTTPS. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html biddingLogicUri` | the target URI used to fetch bidding logic when a custom audience participates in the ad selection process. The URI must use HTTPS. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData> ads` | the list of `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` objects is a full and complete list of the ads that will be served by this `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` during the ad selection process. |
| `https://developer.android.com/reference/java/time/Instant.html activationTime` | optional activation time may be set in the future, in order to serve a delayed activation. If the field is not set, the object will be activated at the time of joining. |
| `https://developer.android.com/reference/java/time/Instant.html expirationTime` | optional expiration time. Once it has passed, a custom audience is no longer eligible for daily ad/bidding data updates or participation in the ad selection process. The custom audience will then be deleted from memory by the next daily update. |
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdSelectionSignals userBiddingSignals` | optional User bidding signals, provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment. |
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData trustedBiddingSignals` | optional trusted bidding data, consists of a URI pointing to a trusted server for buyers' bidding data and a list of keys to query the server with. |

### CustomAudience

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
@ExperimentalFeatures.Ext14OptIn
public CustomAudience(
    @NonNull AdTechIdentifier buyer,
    @NonNull String name,
    @NonNull Uri dailyUpdateUri,
    @NonNull Uri biddingLogicUri,
    @NonNull List<@NonNull AdData> ads,
    Instant activationTime,
    Instant expirationTime,
    AdSelectionSignals userBiddingSignals,
    TrustedBiddingData trustedBiddingSignals,
    int auctionServerRequestFlags,
    double priority
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdTechIdentifier buyer` | A buyer is identified by a domain in the form "buyerexample.com". |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name` | The custom audience's name is an arbitrary string provided by the owner and buyer on creation of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` object. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html dailyUpdateUri` | a URI that points to a buyer-operated server that hosts updated bidding data and ads metadata to be used in the on-device ad selection process. The URI must use HTTPS. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html biddingLogicUri` | the target URI used to fetch bidding logic when a custom audience participates in the ad selection process. The URI must use HTTPS. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData> ads` | the list of `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` objects is a full and complete list of the ads that will be served by this `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` during the ad selection process. |
| `https://developer.android.com/reference/java/time/Instant.html activationTime` | optional activation time may be set in the future, in order to serve a delayed activation. If the field is not set, the object will be activated at the time of joining. |
| `https://developer.android.com/reference/java/time/Instant.html expirationTime` | optional expiration time. Once it has passed, a custom audience is no longer eligible for daily ad/bidding data updates or participation in the ad selection process. The custom audience will then be deleted from memory by the next daily update. |
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdSelectionSignals userBiddingSignals` | optional User bidding signals, provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment. |
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData trustedBiddingSignals` | optional trusted bidding data, consists of a URI pointing to a trusted server for buyers' bidding data and a list of keys to query the server with. |
| `int auctionServerRequestFlags` | the bitfield of auction server request flags. These are flags that influence the creation of the payload generated by the getAdSelectionData API. Value is either `0` or a combination of the following: - `0` - `1` <br /> |
| `double priority` | representing the priority of this custom audience. If there is insufficient space during the buyer input generation in the getAdSelectionData call, the service will attempt to include the highest priority custom audiences first. |

## Public methods

### equals

```
public boolean equals(Object other)
```

Checks whether two `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` objects contain the same information.

### getActivationTime

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

```
public final Instant getActivationTime()
```

optional activation time may be set in the future, in order to serve a delayed activation. If the field is not set, the object will be activated at the time of joining.

### getAds

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

```
public final @NonNull List<@NonNull AdData> getAds()
```

the list of `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` objects is a full and complete list of the ads that will be served by this `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` during the ad selection process.

### getAuctionServerRequestFlags

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
public final int getAuctionServerRequestFlags()
```

the bitfield of auction server request flags. These are flags that influence the creation of the payload generated by the getAdSelectionData API.

### getBiddingLogicUri

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

```
public final @NonNull Uri getBiddingLogicUri()
```

the target URI used to fetch bidding logic when a custom audience participates in the ad selection process. The URI must use HTTPS.

### getBuyer

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

```
public final @NonNull AdTechIdentifier getBuyer()
```

A buyer is identified by a domain in the form "buyerexample.com".

### getDailyUpdateUri

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

```
public final @NonNull Uri getDailyUpdateUri()
```

a URI that points to a buyer-operated server that hosts updated bidding data and ads metadata to be used in the on-device ad selection process. The URI must use HTTPS.

### getExpirationTime

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

```
public final Instant getExpirationTime()
```

optional expiration time. Once it has passed, a custom audience is no longer eligible for daily ad/bidding data updates or participation in the ad selection process. The custom audience will then be deleted from memory by the next daily update.

### getName

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

```
public final @NonNull String getName()
```

The custom audience's name is an arbitrary string provided by the owner and buyer on creation of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` object.

### getPriority

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
public final double getPriority()
```

representing the priority of this custom audience. If there is insufficient space during the buyer input generation in the getAdSelectionData call, the service will attempt to include the highest priority custom audiences first.

### getTrustedBiddingSignals

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

```
public final TrustedBiddingData getTrustedBiddingSignals()
```

optional trusted bidding data, consists of a URI pointing to a trusted server for buyers' bidding data and a list of keys to query the server with.

### getUserBiddingSignals

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

```
public final AdSelectionSignals getUserBiddingSignals()
```

optional User bidding signals, provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment.

### hashCode

```
public int hashCode()
```

Returns the hash of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/customaudience/CustomAudience` object's data.

### toString

```
public @NonNull String toString()
```