MeasurementManager
  public
  
  
  
  class
  MeasurementManager
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.adservices.measurement.MeasurementManager | 
MeasurementManager provides APIs to manage source and trigger registrations.
Summary
| Constants | |
|---|---|
| int | MEASUREMENT_API_STATE_DISABLEDThis state indicates that Measurement APIs are unavailable. | 
| int | MEASUREMENT_API_STATE_ENABLEDThis state indicates that Measurement APIs are enabled. | 
| Inherited methods | |
|---|---|
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<Object, Exception> callback)
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 OutcomeReceiver.onError(E). Both success and failure feedback are executed on the provided
 Executor.
| Parameters | |
|---|---|
| deletionRequest | DeletionRequest: The request for deleting data.
 This value cannot benull. | 
| executor | Executor: The executor to run callback.
 This value cannot benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | OutcomeReceiver: intended to notify asynchronously the API result.
 This value cannot benull. | 
deleteRegistrations
public void deleteRegistrations (DeletionRequest deletionRequest, Executor executor, AdServicesOutcomeReceiver<Object, Exception> callback)
      This method was deprecated
      in API level 36.
    use deleteRegistrations(android.adservices.measurement.DeletionRequest, java.util.concurrent.Executor, android.os.OutcomeReceiver)
     instead. Android R is no longer supported.
  
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 OutcomeReceiver.onError(E). 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 benull. | 
| executor | Executor: The executor to run callback.
 This value cannot benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | AdServicesOutcomeReceiver: intended to notify asynchronously the API result.
 This value cannot benull. | 
get
public static MeasurementManager get (Context context)
Factory method for creating an instance of MeasurementManager.
| Parameters | |
|---|---|
| context | Context: TheContextto use
 This value cannot benull. | 
| Returns | |
|---|---|
| MeasurementManager | A MeasurementManagerinstance
 This value cannot benull. | 
getMeasurementApiStatus
public void getMeasurementApiStatus (Executor executor, AdServicesOutcomeReceiver<Integer, Exception> callback)
      This method was deprecated
      in API level 36.
    use getMeasurementApiStatus(java.util.concurrent.Executor, android.os.OutcomeReceiver) instead. Android
     R is no longer supported.
  
Gets Measurement API status.
The callback's Integer value is one of MeasurementApiState.
 
For use on Android R or lower.
 
 Requires AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION
| Parameters | |
|---|---|
| executor | Executor: used by callback to dispatch results.
 This value cannot benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | AdServicesOutcomeReceiver: intended to notify asynchronously the API result.
 This value cannot benull. | 
getMeasurementApiStatus
public void getMeasurementApiStatus (Executor executor, OutcomeReceiver<Integer, Exception> callback)
Gets 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 benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | OutcomeReceiver: intended to notify asynchronously the API result.
 This value cannot benull. | 
registerSource
public void registerSource (Uri attributionSource, InputEvent inputEvent, Executor executor, OutcomeReceiver<Object, Exception> callback)
Registers 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. The source metadata is stored on device, making
     it eligible to be matched to future triggers.
 This value cannot benull. | 
| inputEvent | InputEvent: either anInputEventobject (for a click event) or null (for a view
     event). | 
| executor | Executor: used by callback to dispatch results.
 This value may benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | OutcomeReceiver: intended to notify asynchronously the API result.
 This value may benull. | 
| Throws | |
|---|---|
| IllegalArgumentException | if the scheme for attributionSourceis not HTTPS | 
registerSource
public void registerSource (SourceRegistrationRequest request, Executor executor, AdServicesOutcomeReceiver<Object, Exception> callback)
      This method was deprecated
      in API level 36.
    use registerSource(android.adservices.measurement.SourceRegistrationRequest, java.util.concurrent.Executor, android.os.OutcomeReceiver)
     instead. Android R is no longer supported.
  
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 AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION
| Parameters | |
|---|---|
| request | SourceRegistrationRequest: app source registration request
 This value cannot benull. | 
| executor | Executor: used by callback to dispatch results
 This value may benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | AdServicesOutcomeReceiver: intended to notify asynchronously the API result
 This value may benull. | 
registerSource
public void registerSource (SourceRegistrationRequest request, Executor executor, OutcomeReceiver<Object, Exception> callback)
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 AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION
| Parameters | |
|---|---|
| request | SourceRegistrationRequest: app source registration request
 This value cannot benull. | 
| executor | Executor: used by callback to dispatch results
 This value may benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | OutcomeReceiver: intended to notify asynchronously the API result
 This value may benull. | 
registerSource
public void registerSource (Uri attributionSource, InputEvent inputEvent, Executor executor, AdServicesOutcomeReceiver<Object, Exception> callback)
      This method was deprecated
      in API level 36.
    use registerSource(android.net.Uri, android.view.InputEvent, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead.
     Android R is no longer supported.
  
Registers an attribution source (click or view). For use on Android R or lower.
 
 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. The source metadata is stored on device, making
     it eligible to be matched to future triggers.
 This value cannot benull. | 
| inputEvent | InputEvent: either anInputEventobject (for a click event) or null (for a view
     event). | 
| executor | Executor: used by callback to dispatch results.
 This value may benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | AdServicesOutcomeReceiver: intended to notify asynchronously the API result.
 This value may benull. | 
registerTrigger
public void registerTrigger (Uri trigger, Executor executor, AdServicesOutcomeReceiver<Object, Exception> callback)
      This method was deprecated
      in API level 36.
    use registerTrigger(android.net.Uri, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead. Android R
     is no longer supported.
  
Registers a trigger (conversion). For use on Android R or lower.
 
 Requires 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 benull. | 
| executor | Executor: used by callback to dispatch results.
 This value may benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | AdServicesOutcomeReceiver: intended to notify asynchronously the API result.
 This value may benull. | 
registerTrigger
public void registerTrigger (Uri trigger, Executor executor, OutcomeReceiver<Object, Exception> callback)
Registers 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. The trigger metadata is stored on-device, and is eligible to be matched with
     sources during the attribution process.
 This value cannot benull. | 
| executor | Executor: used by callback to dispatch results.
 This value may benull.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread. | 
| callback | OutcomeReceiver: intended to notify asynchronously the API result.
 This value may benull. | 
| Throws | |
|---|---|
| IllegalArgumentException | if the scheme for triggeris not HTTPS | 
registerWebSource
public void registerWebSource (WebSourceRegistrationRequest request, Executor executor, OutcomeReceiver<Object, Exception> callback)
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 OutcomeReceiver.onResult(R) 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 AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION
| Parameters | |
|---|---|
| request | WebSourceRegistrationRequest: source registration request
 This value cannot benull. | 
| executor | Executor: used by callback to dispatch results.
 This value may benull. | 
| callback | OutcomeReceiver: intended to notify asynchronously the API result.
 This value may benull. | 
registerWebSource
public void registerWebSource (WebSourceRegistrationRequest request, Executor executor, AdServicesOutcomeReceiver<Object, Exception> callback)
      This method was deprecated
      in API level 36.
    use registerWebSource(android.adservices.measurement.WebSourceRegistrationRequest, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead. Android R is no longer supported.
  
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 OutcomeReceiver.onResult(R) 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 AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION
| Parameters | |
|---|---|
| request | WebSourceRegistrationRequest: source registration request
 This value cannot benull. | 
| executor | Executor: used by callback to dispatch results.
 This value may benull. | 
| callback | AdServicesOutcomeReceiver: intended to notify asynchronously the API result.
 This value may benull. | 
registerWebTrigger
public void registerWebTrigger (WebTriggerRegistrationRequest request, Executor executor, AdServicesOutcomeReceiver<Object, Exception> callback)
      This method was deprecated
      in API level 36.
    use registerWebTrigger(android.adservices.measurement.WebTriggerRegistrationRequest, java.util.concurrent.Executor, android.os.OutcomeReceiver) instead. Anrdoid R is no longer supported.
  
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 OutcomeReceiver.onResult(R) 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 AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION
| Parameters | |
|---|---|
| request | WebTriggerRegistrationRequest: trigger registration request
 This value cannot benull. | 
| executor | Executor: used by callback to dispatch results
 This value may benull. | 
| callback | AdServicesOutcomeReceiver: intended to notify asynchronously the API result
 This value may benull. | 
registerWebTrigger
public void registerWebTrigger (WebTriggerRegistrationRequest request, Executor executor, OutcomeReceiver<Object, Exception> callback)
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 OutcomeReceiver.onResult(R) 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 AdServicesPermissions.ACCESS_ADSERVICES_ATTRIBUTION
| Parameters | |
|---|---|
| request | WebTriggerRegistrationRequest: trigger registration request
 This value cannot benull. | 
| executor | Executor: used by callback to dispatch results
 This value may benull. | 
| callback | OutcomeReceiver: intended to notify asynchronously the API result
 This value may benull. | 
