MeasurementManager


open class MeasurementManager
kotlin.Any
   ↳ android.adservices.measurement.MeasurementManager

MeasurementManager provides APIs to manage source and trigger registrations.

Summary

Constants
static Int

This state indicates that Measurement APIs are unavailable.

static Int

This state indicates that Measurement APIs are enabled.

Public methods
open Unit
deleteRegistrations(deletionRequest: DeletionRequest, executor: Executor, callback: AdServicesOutcomeReceiver<Any!, Exception!>)

Deletes previous registrations.

open Unit
deleteRegistrations(deletionRequest: DeletionRequest, executor: Executor, callback: OutcomeReceiver<Any!, Exception!>)

Deletes previous registrations.

open static MeasurementManager
get(context: Context)

Factory method for creating an instance of MeasurementManager.

open Unit

Gets Measurement API status.

open Unit

Gets Measurement API status.

open Unit

Registers attribution sources(click or view) from an app context.

open Unit

Registers attribution sources(click or view) from an app context.

open Unit
registerSource(attributionSource: Uri, inputEvent: InputEvent?, executor: Executor?, callback: AdServicesOutcomeReceiver<Any!, Exception!>?)

Registers an attribution source (click or view).

open Unit
registerSource(attributionSource: Uri, inputEvent: InputEvent?, executor: Executor?, callback: OutcomeReceiver<Any!, Exception!>?)

Registers an attribution source (click or view).

open Unit
registerTrigger(trigger: Uri, executor: Executor?, callback: AdServicesOutcomeReceiver<Any!, Exception!>?)

Registers a trigger (conversion).

open Unit
registerTrigger(trigger: Uri, executor: Executor?, callback: OutcomeReceiver<Any!, Exception!>?)

Registers a trigger (conversion).

open Unit

Registers an attribution source(click or view) from web context.

open Unit

Registers an attribution source(click or view) from web context.

open Unit

Registers an attribution trigger(click or view) from web context.

open Unit

Registers an attribution trigger(click or view) from web context.

Constants

MEASUREMENT_API_STATE_DISABLED

static val MEASUREMENT_API_STATE_DISABLED: Int

This state indicates that Measurement APIs are unavailable. Invoking them will result in an UnsupportedOperationException.

Value: 0

MEASUREMENT_API_STATE_ENABLED

static val MEASUREMENT_API_STATE_ENABLED: Int

This state indicates that Measurement APIs are enabled.

Value: 1

Public methods

deleteRegistrations

open fun deleteRegistrations(
    deletionRequest: DeletionRequest,
    executor: Executor,
    callback: AdServicesOutcomeReceiver<Any!, Exception!>
): Unit

Deletes previous registrations.

If the deletion is successful, the callback's OutcomeReceiver.onResult is invoked with null. In case of failure, a Exception is sent through the callback's android.os.OutcomeReceiver#onError. Both success and failure feedback are executed on the provided Executor.

For use on Android R or lower.

Parameters
deletionRequest DeletionRequest: The request for deleting data. This value cannot be null.
executor Executor: The executor to run callback. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback AdServicesOutcomeReceiver<Any!, Exception!>: intended to notify asynchronously the API result. This value cannot be null.

deleteRegistrations

open fun deleteRegistrations(
    deletionRequest: DeletionRequest,
    executor: Executor,
    callback: OutcomeReceiver<Any!, Exception!>
): Unit

Deletes previous registrations.

If the deletion is successful, the callback's OutcomeReceiver.onResult is invoked with null. In case of failure, a Exception is sent through the callback's android.os.OutcomeReceiver#onError. Both success and failure feedback are executed on the provided Executor.

Parameters
deletionRequest DeletionRequest: The request for deleting data. This value cannot be null.
executor Executor: The executor to run callback. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback OutcomeReceiver<Any!, Exception!>: intended to notify asynchronously the API result. This value cannot be null.

get

open static fun get(context: Context): MeasurementManager

Factory method for creating an instance of MeasurementManager.

Parameters
context Context: The Context to use This value cannot be null.
Return
MeasurementManager A MeasurementManager instance This value cannot be null.

getMeasurementApiStatus

open fun getMeasurementApiStatus(
    executor: Executor,
    callback: AdServicesOutcomeReceiver<Int!, Exception!>
): Unit

Gets Measurement API status.

The callback's Integer value is one of MeasurementApiState.

For use on Android R or lower.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
executor Executor: used by callback to dispatch results. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback AdServicesOutcomeReceiver<Int!, Exception!>: intended to notify asynchronously the API result. This value cannot be null.

getMeasurementApiStatus

open fun getMeasurementApiStatus(
    executor: Executor,
    callback: OutcomeReceiver<Int!, Exception!>
): Unit

Gets Measurement API status.

The callback's Integer value is one of MeasurementApiState.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
executor Executor: used by callback to dispatch results. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback OutcomeReceiver<Int!, Exception!>: intended to notify asynchronously the API result. This value cannot be null.

registerSource

open fun registerSource(
    request: SourceRegistrationRequest,
    executor: Executor?,
    callback: AdServicesOutcomeReceiver<Any!, Exception!>?
): Unit

Registers attribution sources(click or view) from an app context.

This API will not process any redirects, all registration URLs should be supplied with the request. For use on Android R or lower.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
request SourceRegistrationRequest: app source registration request This value cannot be null.
executor Executor?: used by callback to dispatch results This value may be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback AdServicesOutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result This value may be null.

registerSource

open fun registerSource(
    request: SourceRegistrationRequest,
    executor: Executor?,
    callback: OutcomeReceiver<Any!, Exception!>?
): Unit

Registers attribution sources(click or view) from an app context.

This API will not process any redirects, all registration URLs should be supplied with the request.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
request SourceRegistrationRequest: app source registration request This value cannot be null.
executor Executor?: used by callback to dispatch results This value may be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback OutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result This value may be null.

registerSource

open fun registerSource(
    attributionSource: Uri,
    inputEvent: InputEvent?,
    executor: Executor?,
    callback: AdServicesOutcomeReceiver<Any!, Exception!>?
): Unit

Registers an attribution source (click or view). For use on Android R or lower.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
attributionSource Uri: the platform issues a request to this URI in order to fetch metadata associated with the attribution source. The source metadata is stored on device, making it eligible to be matched to future triggers. This value cannot be null.
inputEvent InputEvent?: either an InputEvent object (for a click event) or null (for a view event).
executor Executor?: used by callback to dispatch results. This value may be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback AdServicesOutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result. This value may be null.

registerSource

open fun registerSource(
    attributionSource: Uri,
    inputEvent: InputEvent?,
    executor: Executor?,
    callback: OutcomeReceiver<Any!, Exception!>?
): Unit

Registers an attribution source (click or view).
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
attributionSource Uri: the platform issues a request to this URI in order to fetch metadata associated with the attribution source. The source metadata is stored on device, making it eligible to be matched to future triggers. This value cannot be null.
inputEvent InputEvent?: either an InputEvent object (for a click event) or null (for a view event).
executor Executor?: used by callback to dispatch results. This value may be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback OutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result. This value may be null.
Exceptions
java.lang.IllegalArgumentException if the scheme for attributionSource is not HTTPS

registerTrigger

open fun registerTrigger(
    trigger: Uri,
    executor: Executor?,
    callback: AdServicesOutcomeReceiver<Any!, Exception!>?
): Unit

Registers a trigger (conversion). For use on Android R or lower.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
trigger Uri: the API issues a request to this URI to fetch metadata associated with the trigger. The trigger metadata is stored on-device, and is eligible to be matched with sources during the attribution process. This value cannot be null.
executor Executor?: used by callback to dispatch results. This value may be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback AdServicesOutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result. This value may be null.

registerTrigger

open fun registerTrigger(
    trigger: Uri,
    executor: Executor?,
    callback: OutcomeReceiver<Any!, Exception!>?
): Unit

Registers a trigger (conversion).
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
trigger Uri: the API issues a request to this URI to fetch metadata associated with the trigger. The trigger metadata is stored on-device, and is eligible to be matched with sources during the attribution process. This value cannot be null.
executor Executor?: used by callback to dispatch results. This value may be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
callback OutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result. This value may be null.
Exceptions
java.lang.IllegalArgumentException if the scheme for trigger is not HTTPS

registerWebSource

open fun registerWebSource(
    request: WebSourceRegistrationRequest,
    executor: Executor?,
    callback: AdServicesOutcomeReceiver<Any!, Exception!>?
): Unit

Registers an attribution source(click or view) from web context.

This API will not process any redirects, all registration URLs should be supplied with the request. At least one of appDestination or webDestination parameters are required to be provided. If the registration is successful, callback's android.os.OutcomeReceiver#onResult is invoked with null. In case of failure, a Exception is sent through callback's OutcomeReceiver.onError. Both success and failure feedback are executed on the provided Executor.

For use on Android R or lower.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
request WebSourceRegistrationRequest: source registration request This value cannot be null.
executor Executor?: used by callback to dispatch results. This value may be null.
callback AdServicesOutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result. This value may be null.

registerWebSource

open fun registerWebSource(
    request: WebSourceRegistrationRequest,
    executor: Executor?,
    callback: OutcomeReceiver<Any!, Exception!>?
): Unit

Registers an attribution source(click or view) from web context.

This API will not process any redirects, all registration URLs should be supplied with the request. At least one of appDestination or webDestination parameters are required to be provided. If the registration is successful, callback's android.os.OutcomeReceiver#onResult is invoked with null. In case of failure, a Exception is sent through callback's OutcomeReceiver.onError. Both success and failure feedback are executed on the provided Executor.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
request WebSourceRegistrationRequest: source registration request This value cannot be null.
executor Executor?: used by callback to dispatch results. This value may be null.
callback OutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result. This value may be null.

registerWebTrigger

open fun registerWebTrigger(
    request: WebTriggerRegistrationRequest,
    executor: Executor?,
    callback: AdServicesOutcomeReceiver<Any!, Exception!>?
): Unit

Registers an attribution trigger(click or view) from web context.

This API will not process any redirects, all registration URLs should be supplied with the request. If the registration is successful, callback's android.os.OutcomeReceiver#onResult is invoked with null. In case of failure, a Exception is sent through callback's OutcomeReceiver.onError. Both success and failure feedback are executed on the provided Executor.

For use on Android R or lower.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
request WebTriggerRegistrationRequest: trigger registration request This value cannot be null.
executor Executor?: used by callback to dispatch results This value may be null.
callback AdServicesOutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result This value may be null.

registerWebTrigger

open fun registerWebTrigger(
    request: WebTriggerRegistrationRequest,
    executor: Executor?,
    callback: OutcomeReceiver<Any!, Exception!>?
): Unit

Registers an attribution trigger(click or view) from web context.

This API will not process any redirects, all registration URLs should be supplied with the request. If the registration is successful, callback's android.os.OutcomeReceiver#onResult is invoked with null. In case of failure, a Exception is sent through callback's OutcomeReceiver.onError. Both success and failure feedback are executed on the provided Executor.
Requires android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_ATTRIBUTION

Parameters
request WebTriggerRegistrationRequest: trigger registration request This value cannot be null.
executor Executor?: used by callback to dispatch results This value may be null.
callback OutcomeReceiver<Any!, Exception!>?: intended to notify asynchronously the API result This value may be null.