[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  
Summary: [Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/EventUrlProvider#pubmethods) \| [Inherited Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/EventUrlProvider#inhmethods)  

# EventUrlProvider


`
public


class
EventUrlProvider
`


`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


`

`


`

|---|-------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.adservices.ondevicepersonalization.EventUrlProvider |

<br />

*** ** * ** ***

Generates event tracking URLs for a request. The service can embed these URLs within the
HTML output as needed. When the HTML is rendered within an ODP WebView, ODP will intercept
requests to these URLs, call
`IsolatedWorker#onEvent(EventInput, java.util.function.Consumer)`, and log the returned
output in the EVENTS table.

## Summary

|                                                                                                                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                                                                                                                               ||
|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[Uri](https://developer.android.com/reference/android/net/Uri) | ` `[createEventTrackingUrlWithRedirect](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/EventUrlProvider#createEventTrackingUrlWithRedirect(android.os.PersistableBundle,%20android.net.Uri))`(`[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle)` eventParams, `[Uri](https://developer.android.com/reference/android/net/Uri)` destinationUrl) ` Creates an event tracking URL that redirects to the provided destination URL when it is clicked in an ODP webview. |
| ` `[Uri](https://developer.android.com/reference/android/net/Uri) | ` `[createEventTrackingUrlWithResponse](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/EventUrlProvider#createEventTrackingUrlWithResponse(android.os.PersistableBundle,%20byte[],%20java.lang.String))`(`[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle)` eventParams, byte[] responseData, `[String](https://developer.android.com/reference/java/lang/String)` mimeType) ` Creates an event tracking URL that returns the provided response.                    |

| ### Inherited methods |
|-----------------------|---|
| From class ` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                        | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                             | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                            | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`.                                                                                                                                                 | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                   | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                              | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                           | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                              | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(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](https://developer.android.com/reference/java/lang/Object#wait(long))`(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](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.                                                                                             | ||

## Public methods

### createEventTrackingUrlWithRedirect

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public Uri createEventTrackingUrlWithRedirect (PersistableBundle eventParams, 
                Uri destinationUrl)
```

Creates an event tracking URL that redirects to the provided destination URL when it is
clicked in an ODP webview.

<br />


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

|                                                                                         Parameters                                                                                          ||
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `eventParams`    | `PersistableBundle`: The data to be passed to `IsolatedWorker#onEvent(EventInput, java.util.function.Consumer)` when the event occurs This value cannot be `null`. <br /> |
| `destinationUrl` | `Uri`: The URL to redirect to. This value may be `null`. <br />                                                                                                           |

|                                                                          Returns                                                                          ||
|----------------------------------------------------------------|-------------------------------------------------------------------------------------------|
| [Uri](https://developer.android.com/reference/android/net/Uri) | An ODP event URL that can be inserted into a WebView. This value cannot be `null`. <br /> |

### createEventTrackingUrlWithResponse

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public Uri createEventTrackingUrlWithResponse (PersistableBundle eventParams, 
                byte[] responseData, 
                String mimeType)
```

Creates an event tracking URL that returns the provided response. Returns HTTP Status
200 (OK) if the response data is not empty. Returns HTTP Status 204 (No Content) if the
response data is empty.

<br />


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

|                                                                                         Parameters                                                                                         ||
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `eventParams`  | `PersistableBundle`: The data to be passed to `IsolatedWorker#onEvent(EventInput, java.util.function.Consumer)` when the event occurs. This value cannot be `null`. <br /> |
| `responseData` | `byte`: The content to be returned to the WebView when the URL is fetched. This value may be `null`. <br />                                                                |
| `mimeType`     | `String`: The Mime Type of the URL response. This value may be `null`. <br />                                                                                              |

|                                                                          Returns                                                                          ||
|----------------------------------------------------------------|-------------------------------------------------------------------------------------------|
| [Uri](https://developer.android.com/reference/android/net/Uri) | An ODP event URL that can be inserted into a WebView. This value cannot be `null`. <br /> |