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

public class MeasurementManager
extends Object



MeasurementManager.

Summary

Constants

int MEASUREMENT_API_STATE_DISABLED

This state indicates that Measurement APIs are unavailable.

int MEASUREMENT_API_STATE_ENABLED

This state indicates that Measurement APIs are enabled.

Public methods

void deleteRegistrations(DeletionRequest deletionRequest, Executor executor, OutcomeReceiver<ObjectException> callback)

Delete previous registrations.

void getMeasurementApiStatus(Executor executor, OutcomeReceiver<IntegerException> callback)

Get Measurement API status.

void registerSource(Uri attributionSource, InputEvent inputEvent, Executor executor, OutcomeReceiver<ObjectException> callback)

Register an attribution source (click or view).

void registerTrigger(Uri trigger, Executor executor, OutcomeReceiver<ObjectException> callback)

Register a trigger (conversion).

void registerWebSource(WebSourceRegistrationRequest request, Executor executor, OutcomeReceiver<ObjectException> callback)

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

void registerWebTrigger(WebTriggerRegistrationRequest request, Executor executor, OutcomeReceiver<ObjectException> callback)

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

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Constants

MEASUREMENT_API_STATE_DISABLED

public static final int MEASUREMENT_API_STATE_DISABLED

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

Constant Value: 0 (0x00000000)

MEASUREMENT_API_STATE_ENABLED

public static final int MEASUREMENT_API_STATE_ENABLED

This state indicates that Measurement APIs are enabled.

Constant Value: 1 (0x00000001)

Public methods

deleteRegistrations

public void deleteRegistrations (DeletionRequest deletionRequest, 
                Executor executor, 
                OutcomeReceiver<ObjectException> callback)

Delete previous registrations. If the deletion is successful, the callback's OutcomeReceiver.onResult(R) is invoked with null. In case of failure, a Exception is sent through the callback's 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: intended to notify asynchronously the API result. This value cannot be null.

getMeasurementApiStatus

public void getMeasurementApiStatus (Executor executor, 
                OutcomeReceiver<IntegerException> callback)

Get Measurement API status.

The callback's Integer value is one of MeasurementApiState.
Requires 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: intended to notify asynchronously the API result. This value cannot be null.

registerSource

public void registerSource (Uri attributionSource, 
                InputEvent inputEvent, 
                Executor executor, 
                OutcomeReceiver<ObjectException> callback)

Register an attribution source (click or view).
Requires 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. 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: intended to notify asynchronously the API result. This value may be null.

registerTrigger

public void registerTrigger (Uri trigger, 
                Executor executor, 
                OutcomeReceiver<ObjectException> callback)

Register a trigger (conversion).
Requires AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION

Parameters
trigger Uri: the API issues a request to this URI to fetch metadata associated with the trigger. 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: intended to notify asynchronously the API result. This value may be null.

registerWebSource

public void registerWebSource (WebSourceRegistrationRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> callback)

Register 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 OutcomeReceiver#onResult is invoked with null. In case of failure, a Exception is sent through callback's OutcomeReceiver.onError(E). Both success and failure feedback are executed on the provided Executor.
Requires 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: intended to notify asynchronously the API result. This value may be null.

registerWebTrigger

public void registerWebTrigger (WebTriggerRegistrationRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> callback)

Register 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 OutcomeReceiver#onResult is invoked with null. In case of failure, a Exception is sent through callback's OutcomeReceiver.onError(E). Both success and failure feedback are executed on the provided Executor.
Requires 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: intended to notify asynchronously the API result This value may be null.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2023-02-08 UTC.