Stay organized with collections Save and categorize content based on your preferences.

CustomAudience.Builder

public static final class CustomAudience.Builder
extends Object

java.lang.Object
   ↳ android.adservices.customaudience.CustomAudience.Builder


Builder for CustomAudience objects.

Summary

Public constructors

Builder()

Public methods

CustomAudience build()

Builds an instance of a CustomAudience.

CustomAudience.Builder setActivationTime(Instant activationTime)

Sets the time, truncated to milliseconds, after which the CustomAudience will serve ads.

CustomAudience.Builder setAds(List<AdData> ads)

Sets the initial remarketing ads served by the custom audience.

CustomAudience.Builder setBiddingLogicUrl(Uri biddingLogicUrl)

Sets the URL to fetch bidding logic from for use in the ad selection process.

CustomAudience.Builder setBuyer(AdTechIdentifier buyer)

Sets the buyer AdTechIdentifier.

CustomAudience.Builder setDailyUpdateUrl(Uri dailyUpdateUrl)

Sets the daily update URL.

CustomAudience.Builder setExpirationTime(Instant expirationTime)

Sets the time, truncated to milliseconds, after which the CustomAudience should be removed.

CustomAudience.Builder setName(String name)

Sets the CustomAudience object's name.

CustomAudience.Builder setOwnerPackageName(String ownerPackageName)

Sets the owner application package name.

CustomAudience.Builder setTrustedBiddingData(TrustedBiddingData trustedBiddingData)

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

CustomAudience.Builder setUserBiddingSignals(AdSelectionSignals userBiddingSignals)

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

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

public CustomAudience build ()

Builds an instance of a CustomAudience.

Returns
CustomAudience This value cannot be null.

Throws
NullPointerException if any non-null parameter is null
IllegalArgumentException if the expiration time occurs before activation time
IllegalArgumentException if the expiration time is set before the current time

setActivationTime

public CustomAudience.Builder setActivationTime (Instant activationTime)

Sets the time, truncated to milliseconds, after which the CustomAudience will serve ads.

Set to null in order for this CustomAudience to be immediately active and participate in ad selection.

See CustomAudience.getActivationTime() for more information.

Parameters
activationTime Instant: This value may be null.

Returns
CustomAudience.Builder

setAds

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() for more information.

Parameters
ads List: This value may be null.

Returns
CustomAudience.Builder This value cannot be null.

setBiddingLogicUrl

public CustomAudience.Builder setBiddingLogicUrl (Uri biddingLogicUrl)

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

See CustomAudience.getBiddingLogicUrl() ()} for more information.

Parameters
biddingLogicUrl Uri: This value cannot be null.

Returns
CustomAudience.Builder This value cannot be null.

setBuyer

public CustomAudience.Builder setBuyer (AdTechIdentifier buyer)

Sets the buyer AdTechIdentifier.

See CustomAudience.getBuyer() for more information.

Parameters
buyer AdTechIdentifier: This value cannot be null.

Returns
CustomAudience.Builder This value cannot be null.

setDailyUpdateUrl

public CustomAudience.Builder setDailyUpdateUrl (Uri dailyUpdateUrl)

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

See CustomAudience.getDailyUpdateUrl() for more information.

Parameters
dailyUpdateUrl Uri: This value cannot be null.

Returns
CustomAudience.Builder This value cannot be null.

setExpirationTime

public CustomAudience.Builder setExpirationTime (Instant expirationTime)

Sets the time, truncated to milliseconds, after which the CustomAudience should be removed.

See CustomAudience.getExpirationTime() for more information.

Parameters
expirationTime Instant: This value may be null.

Returns
CustomAudience.Builder This value cannot be null.

setName

public CustomAudience.Builder setName (String name)

Sets the CustomAudience object's name.

See CustomAudience.getName() for more information.

Parameters
name String: This value cannot be null.

Returns
CustomAudience.Builder This value cannot be null.

setOwnerPackageName

public CustomAudience.Builder setOwnerPackageName (String ownerPackageName)

Sets the owner application package name.

The value of this field should be the package name of the calling app. Supplying another app's package name will result in failure when calling CustomAudienceManager.joinCustomAudience(android.adservices.customaudience.JoinCustomAudienceRequest, java.util.concurrent.Executor, android.os.OutcomeReceiver).

See CustomAudience.getOwnerPackageName() for more information.

Parameters
ownerPackageName String: This value cannot be null.

Returns
CustomAudience.Builder This value cannot be null.

setTrustedBiddingData

public CustomAudience.Builder setTrustedBiddingData (TrustedBiddingData trustedBiddingData)

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

See CustomAudience.getTrustedBiddingData() for more information.

Parameters
trustedBiddingData TrustedBiddingData: This value may be null.

Returns
CustomAudience.Builder This value cannot be null.

setUserBiddingSignals

public CustomAudience.Builder setUserBiddingSignals (AdSelectionSignals userBiddingSignals)

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

See CustomAudience.getUserBiddingSignals() for more information.

Parameters
userBiddingSignals AdSelectionSignals: This value may be null.

Returns
CustomAudience.Builder This value cannot be null.