AdId


open class AdId
kotlin.Any
   ↳ android.adservices.adid.AdId

A unique, user-resettable, device-wide, per-profile ID for advertising.

Ad networks may use AdId to monetize for Interest Based Advertising (IBA), i.e. targeting and remarketing ads. The user may limit availability of this identifier.

Summary

Constants
static String

A zeroed-out ad id that is returned when the user has limited ad tracking.

Public constructors
AdId(adId: String, limitAdTrackingEnabled: Boolean)

Creates an instance of AdId

Public methods
open Boolean
equals(other: Any?)

open String

The advertising ID.

open Int

open Boolean

Retrieves the limit ad tracking enabled setting.

open String

Constants

ZERO_OUT

static val ZERO_OUT: String

A zeroed-out ad id that is returned when the user has limited ad tracking.

Value: "00000000-0000-0000-0000-000000000000"

Public constructors

AdId

AdId(
    adId: String,
    limitAdTrackingEnabled: Boolean)

Creates an instance of AdId

Parameters
adId String: obtained from the provider service. This value cannot be null.
limitAdTrackingEnabled Boolean: value from the provider service which determines the value of adId.

Public methods

equals

Added in API level 34
open fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getAdId

open fun getAdId(): String

The advertising ID.

The value of advertising Id depends on a combination of isLimitAdTrackingEnabled() and android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_AD_ID.

When the user is limiting ad tracking, the API returns ZERO_OUT. This disallows a caller to track the user for monetization purposes.

Otherwise, a string unique to the device and user is returned, which can be used to track users for advertising.

Return
String This value cannot be null.

hashCode

Added in API level 34
open fun hashCode(): Int
Return
Int a hash code value for this object.

isLimitAdTrackingEnabled

open fun isLimitAdTrackingEnabled(): Boolean

Retrieves the limit ad tracking enabled setting.

This value is true if user has limit ad tracking enabled, false otherwise.

toString

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