CustomAudience


class CustomAudience : Parcelable
kotlin.Any
   ↳ 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

Builder for CustomAudience objects.

Constants
static Int

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

Inherited constants
Public methods
Boolean
equals(other: Any?)

Checks whether two CustomAudience objects contain the same information.

Instant?

On creation of the CustomAudience object, an optional activation time may be set in the future, in order to serve a delayed activation.

MutableList<AdData!>

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.

Int

Returns the bitfield of auction server request flags.

Uri

Returns the target URI used to fetch bidding logic when a custom audience participates in the ad selection process.

AdTechIdentifier

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

Uri

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?

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

The custom audience's name is an arbitrary string provided by the owner and buyer on creation of the CustomAudience object.

TrustedBiddingData?

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?

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

Int

Returns the hash of the CustomAudience object's data.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<CustomAudience!>

Constants

FLAG_AUCTION_SERVER_REQUEST_OMIT_ADS

static val FLAG_AUCTION_SERVER_REQUEST_OMIT_ADS: Int

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

Value: 1

Public methods

equals

Added in API level 34
fun equals(other: Any?): Boolean

Checks whether two CustomAudience objects contain the same information.

Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getActivationTime

fun getActivationTime(): Instant?

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.

Return
Instant? the timestamp Instant, truncated to milliseconds, after which the custom audience is active This value may be null.

getAds

fun getAds(): MutableList<AdData!>

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.

The combined ads size of the CA is limited and the sizes of each ad's string fields are considered using String#getBytes() in UTF-8 encoding.

Return
MutableList<AdData!> a List of AdData objects representing ads currently served by the custom audience This value cannot be null.

getAuctionServerRequestFlags

fun getAuctionServerRequestFlags(): Int

Returns the bitfield of auction server request flags. These are flags that influence the creation of the payload generated by the android.adservices.adselection.AdSelectionManager#getAdSelectionData(GetAdSelectionDataRequest, * Executor, OutcomeReceiver) API.

To create this bitfield, place an | bitwise operator between each android.adservices.customaudience.CustomAudience.AuctionServerRequestFlag to be enabled.

Return
Int Value is either 0 or a combination of android.adservices.customaudience.CustomAudience.FLAG_AUCTION_SERVER_REQUEST_DEFAULT, and android.adservices.customaudience.CustomAudience#FLAG_AUCTION_SERVER_REQUEST_OMIT_ADS

getBiddingLogicUri

fun getBiddingLogicUri(): Uri

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

Return
Uri the URI for fetching buyer bidding logic This value cannot be null.

getBuyer

fun getBuyer(): AdTechIdentifier

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

Return
AdTechIdentifier an AdTechIdentifier containing the custom audience's buyer's domain This value cannot be null.

getDailyUpdateUri

fun getDailyUpdateUri(): Uri

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.

Return
Uri the custom audience's daily update URI This value cannot be null.

getExpirationTime

fun getExpirationTime(): Instant?

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.

Return
Instant? the timestamp Instant, truncated to milliseconds, after which the custom audience should be removed This value may be null.

getName

fun getName(): String

The custom audience's name is an arbitrary string provided by the owner and buyer on creation of the CustomAudience object.

The overall size of the CA is limited and the size of this field is considered using String#getBytes() in UTF-8 encoding.

Return
String the String name of the custom audience This value cannot be null.

getTrustedBiddingData

fun getTrustedBiddingData(): TrustedBiddingData?

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.

Return
TrustedBiddingData? a TrustedBiddingData object containing the custom audience's trusted bidding data This value may be null.

getUserBiddingSignals

fun getUserBiddingSignals(): AdSelectionSignals?

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.

Return
AdSelectionSignals? an AdSelectionSignals object representing the user bidding signals for the custom audience This value may be null.

hashCode

Added in API level 34
fun hashCode(): Int

Returns the hash of the CustomAudience object's data.

Return
Int a hash code value for this object.

toString

Added in API level 34
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 34
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

static val CREATOR: Parcelable.Creator<CustomAudience!>