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 |
| Public constructors | |
|---|---|
|
Creates an instance of |
|
| Public methods | |
|---|---|
| open Boolean | |
| open String |
getAdId()The advertising ID. |
| open Int |
hashCode() |
| open Boolean |
Retrieves the limit ad tracking enabled setting. |
| open String |
toString() |
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
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
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
open fun toString(): String
| Return | |
|---|---|
String |
a string representation of the object. |