Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler#nestedclasses) \| [Methods](https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler#inhmethods)

# FederatedComputeScheduler

*** ** * ** ***


`
public


class
FederatedComputeScheduler
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

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

<br />

*** ** * ** ***


**This class was deprecated
in API level 37.**   

The ODP APIs are deprecated and will not be supported in future Android releases.
There is no direct replacement API available. Developers currently integrated with these APIs
must cease further integration efforts. For comprehensive details regarding this deprecation and
the future roadmap of Privacy Sandbox on Android, please consult the official Privacy Sandbox
developer documentation and announcements:
<https://privacysandbox.google.com>

Handles scheduling federated compute jobs. See `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService#getFederatedComputeScheduler(android.adservices.ondevicepersonalization.RequestToken)`.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler.Params` *This class was deprecated in API level 37. The ODP APIs are deprecated and will not be supported in future Android releases. There is no direct replacement API available. Developers currently integrated with these APIs must cease further integration efforts. For comprehensive details regarding this deprecation and the future roadmap of Privacy Sandbox on Android, please consult the official Privacy Sandbox developer documentation and announcements: <https://privacysandbox.google.com>* |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler#cancel(android.adservices.ondevicepersonalization.FederatedComputeInput)(https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeInput input) ` Cancels a federated compute job with input training params. |
| ` void` | ` https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler#schedule(android.adservices.ondevicepersonalization.FederatedComputeScheduler.Params,%20android.adservices.ondevicepersonalization.FederatedComputeInput)(https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler.Params params, https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeInput input) ` Schedules a federated compute job. |
| ` void` | ` https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduler#schedule(android.adservices.ondevicepersonalization.FederatedComputeScheduleRequest,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.adservices.ondevicepersonalization.FederatedComputeScheduleResponse,java.lang.Exception>)(https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduleRequest federatedComputeScheduleRequest, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/OutcomeReceiver<https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduleResponse, https://developer.android.com/reference/java/lang/Exception> outcomeReceiver) ` Schedules a federated compute job. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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

### cancel

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void cancel (FederatedComputeInput input)
```

Cancels a federated compute job with input training params. In `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService#onRequest(android.adservices.ondevicepersonalization.RequestToken)`, the app can call `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService#getFederatedComputeScheduler(android.adservices.ondevicepersonalization.RequestToken)` to pass scheduler when constructing the `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedWorker`.


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

<br />

| Parameters ||
|---|---|
| `input` | `FederatedComputeInput`: the configuration of the federated compute. It should be consistent with the federated compute server setup. This value cannot be `null`. <br /> |

### schedule

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void schedule (FederatedComputeScheduler.Params params, 
                FederatedComputeInput input)
```

Schedules a federated compute job. In `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService#onRequest(android.adservices.ondevicepersonalization.RequestToken)`, the app can call
`https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService#getFederatedComputeScheduler(android.adservices.ondevicepersonalization.RequestToken)` to pass the scheduler when constructing
the `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedWorker`.


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

<br />

| Parameters ||
|---|---|
| `params` | `FederatedComputeScheduler.Params`: parameters related to job scheduling. This value cannot be `null`. <br /> |
| `input` | `FederatedComputeInput`: the configuration of the federated computation. It should be consistent with the federated compute server setup as described in [Federated Compute Server documentation.](https://developers.google.com/privacy-sandbox/protections/on-device-personalization/federated-compute-server). This value cannot be `null`. <br /> |

### schedule

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void schedule (FederatedComputeScheduleRequest federatedComputeScheduleRequest, 
                Executor executor, 
                OutcomeReceiver<FederatedComputeScheduleResponse, Exception> outcomeReceiver)
```

Schedules a federated compute job. In `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService#onRequest(android.adservices.ondevicepersonalization.RequestToken)`, the app can call
`https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService#getFederatedComputeScheduler(android.adservices.ondevicepersonalization.RequestToken)` to pass the scheduler when constructing
the `https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedWorker`.


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

<br />

| Parameters ||
|---|---|
| `federatedComputeScheduleRequest` | `FederatedComputeScheduleRequest`: input parameters related to job scheduling. This value cannot be `null`. <br /> |
| `executor` | `Executor`: the `https://developer.android.com/reference/java/util/concurrent/Executor` on which to invoke the callback. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `outcomeReceiver` | `OutcomeReceiver`: This either returns a `https://developer.android.com/reference/android/adservices/ondevicepersonalization/FederatedComputeScheduleResponse` on success, or `https://developer.android.com/reference/java/lang/Exception` on failure. The exception type is `https://developer.android.com/reference/android/adservices/ondevicepersonalization/OnDevicePersonalizationException` with error code `https://developer.android.com/reference/android/adservices/ondevicepersonalization/OnDevicePersonalizationException#ERROR_INVALID_TRAINING_MANIFEST` if the manifest is missing the federated compute server URL or `https://developer.android.com/reference/android/adservices/ondevicepersonalization/OnDevicePersonalizationException#ERROR_SCHEDULE_TRAINING_FAILED` when scheduling fails for other reasons. This value cannot be `null`. <br /> |