CustomAudience
  public
  
  final
  
  class
  CustomAudience
  
    extends Object
  
  
  
  
  
      implements
      
        Parcelable
      
  
  
| java.lang.Object | |
| ↳ | android.adservices.customaudience.CustomAudience | 
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 classes | |
|---|---|
| 
        
        
        
        
        class | CustomAudience.BuilderBuilder for  | 
| Inherited constants | 
|---|
| Fields | |
|---|---|
| 
    public
    static
    final
    Creator<CustomAudience> | CREATOR
 | 
| Public methods | |
|---|---|
| 
        
        
        
        
        
        boolean | 
      equals(Object o)
      Checks whether two  | 
| 
        
        
        
        
        
        Instant | 
      getActivationTime()
      On creation of the  | 
| 
        
        
        
        
        
        List<AdData> | 
      getAds()
      This list of  | 
| 
        
        
        
        
        
        Uri | 
      getBiddingLogicUri()
      Returns the target URI used to fetch bidding logic when a custom audience participates in the ad selection process. | 
| 
        
        
        
        
        
        AdTechIdentifier | 
      getBuyer()
      A buyer is identified by a domain in the form "buyerexample.com". | 
| 
        
        
        
        
        
        Uri | 
      getDailyUpdateUri()
      This URI points to a buyer-operated server that hosts updated bidding data and ads metadata to be used in the on-device ad selection process. | 
| 
        
        
        
        
        
        Instant | 
      getExpirationTime()
      Once the expiration time has passed, a custom audience is no longer eligible for daily ad/bidding data updates or participation in the ad selection process. | 
| 
        
        
        
        
        
        String | 
      getName()
      The custom audience's name is an arbitrary string provided by the owner and buyer on creation
 of the  | 
| 
        
        
        
        
        
        TrustedBiddingData | 
      getTrustedBiddingData()
      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. | 
| 
        
        
        
        
        
        AdSelectionSignals | 
      getUserBiddingSignals()
      User bidding signals are optionally provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment. | 
| 
        
        
        
        
        
        int | 
      hashCode()
      Returns the hash of the  | 
| 
        
        
        
        
        
        void | 
      writeToParcel(Parcel dest, int flags)
      Flatten this object in to a Parcel. | 
| Inherited methods | |
|---|---|
Fields
CREATOR
public static final Creator<CustomAudience> CREATOR
Public methods
equals
public boolean equals (Object o)
Checks whether two CustomAudience objects contain the same information.
| Parameters | |
|---|---|
| o | Object: the reference object with which to compare. | 
| Returns | |
|---|---|
| boolean | trueif this object is the same as the obj
          argument;falseotherwise. | 
getActivationTime
public Instant getActivationTime ()
On creation of the CustomAudience object, an optional activation time may be set in
 the future, in order to serve a delayed activation. If the field is not set, the CustomAudience will be activated at the time of joining.
 
For example, a custom audience for lapsed users may not activate until a threshold of inactivity is reached, at which point the custom audience's ads will participate in the ad selection process, potentially redirecting lapsed users to the original owner application.
The maximum delay in activation is 60 days from initial creation.
If specified, the activation time must be an earlier instant than the expiration time.
| Returns | |
|---|---|
| Instant | the timestamp Instant, truncated to milliseconds, after which the custom
     audience is active
 
 This value may benull. | 
getAds
public List<AdData> getAds ()
This list of AdData objects is a full and complete list of the ads that will be
 served by this CustomAudience during the ad selection process.
 
If not specified, or if an empty list is provided, the CustomAudience will not
 participate in ad selection until a valid list of ads are provided via the daily update for
 the custom audience.
| Returns | |
|---|---|
| List<AdData> | a ListofAdDataobjects representing ads currently served by the
     custom audience
 
 This value cannot benull. | 
getBiddingLogicUri
public Uri getBiddingLogicUri ()
Returns the target URI used to fetch bidding logic when a custom audience participates in the ad selection process. The URI must use HTTPS.
| Returns | |
|---|---|
| Uri | the URI for fetching buyer bidding logic
 
 This value cannot be null. | 
getBuyer
public AdTechIdentifier getBuyer ()
A buyer is identified by a domain in the form "buyerexample.com".
| Returns | |
|---|---|
| AdTechIdentifier | an AdTechIdentifiercontaining the custom audience's buyer's domain
 
 This value cannot benull. | 
getDailyUpdateUri
public Uri getDailyUpdateUri ()
This URI 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.
| Returns | |
|---|---|
| Uri | the custom audience's daily update URI
 
 This value cannot be null. | 
getExpirationTime
public Instant getExpirationTime ()
Once the expiration time 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.
If no expiration time is provided on creation of the CustomAudience, expiry will
 default to 60 days from activation.
 
The maximum expiry is 60 days from initial activation.
| Returns | |
|---|---|
| Instant | the timestamp Instant, truncated to milliseconds, after which the custom
     audience should be removed
 
 This value may benull. | 
getName
public String getName ()
The custom audience's name is an arbitrary string provided by the owner and buyer on creation
 of the CustomAudience object.
| Returns | |
|---|---|
| String | the String name of the custom audience
 
 This value cannot be null. | 
getTrustedBiddingData
public TrustedBiddingData getTrustedBiddingData ()
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. Note that the keys are arbitrary identifiers that will only be used to query the trusted server for a buyer's bidding logic during ad selection.
If not specified, the CustomAudience will not participate in ad selection until
 trusted bidding data are provided via the daily update for the custom audience.
| Returns | |
|---|---|
| TrustedBiddingData | a TrustedBiddingDataobject containing the custom audience's trusted bidding
     data
 
 This value may benull. | 
getUserBiddingSignals
public AdSelectionSignals getUserBiddingSignals ()
User bidding signals are optionally provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment.
If the user bidding signals are not a valid JSON object that can be consumed by the buyer's JS, the custom audience will not be eligible for ad selection.
If not specified, the CustomAudience will not participate in ad selection until
 user bidding signals are provided via the daily update for the custom audience.
| Returns | |
|---|---|
| AdSelectionSignals | an AdSelectionSignalsobject representing the user bidding signals for the
     custom audience
 
 This value may benull. | 
hashCode
public int hashCode ()
Returns the hash of the CustomAudience object's data.
| Returns | |
|---|---|
| int | a hash code value for this object. | 
writeToParcel
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
| dest | Parcel: This value cannot benull. | 
| flags | int: Additional flags about how the object should be written.
 May be 0 orParcelable.PARCELABLE_WRITE_RETURN_VALUE.
 
 Value is either0or a combination ofParcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES | 
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
