# SandboxedSdkProviderCompat

Artifact: [androidx.privacysandbox.sdkruntime:sdkruntime-core](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat.kt+class:androidx.privacysandbox.sdkruntime.core.SandboxedSdkProviderCompat) Added in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19) Deprecated in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19)

*** ** * ** ***


```
public abstract class SandboxedSdkProviderCompat
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> This library is no longer supported.

Compat version of `https://developer.android.com/reference/android/app/sdksandbox/SandboxedSdkProvider.html`.

Encapsulates API which SDK sandbox can use to interact with SDKs loaded into it.

SDK has to implement this abstract class to generate an entry point for SDK sandbox to be able to call it through.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/sdksandbox/SandboxedSdkProvider.html` |   |

## Summary

| ### Public constructors |
|---|
| `[SandboxedSdkProviderCompat](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#SandboxedSdkProviderCompat())()` **This method is deprecated.** This library is no longer supported. |

| ### Public methods |
|---|---|
| `final void` | `[attachContext](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#attachContext(android.content.Context))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` **This method is deprecated.** This library is no longer supported. |
| `void` | `[beforeUnloadSdk](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#beforeUnloadSdk())()` **This method is deprecated.** This library is no longer supported. |
| `final https://developer.android.com/reference/android/content/Context.html` | `[getContext](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#getContext())()` **This method is deprecated.** This library is no longer supported. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkCompat` | `[onLoadSdk](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#onLoadSdk(android.os.Bundle))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html params)` **This method is deprecated.** This library is no longer supported. |

## Public constructors

### SandboxedSdkProviderCompat

Added in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19) Deprecated in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19)

```
public [SandboxedSdkProviderCompat](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#SandboxedSdkProviderCompat())()
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

## Public methods

### attachContext

Added in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19) Deprecated in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19)

```
public final void [attachContext](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#attachContext(android.content.Context))(@NonNull Context context)
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

Sets the SDK `https://developer.android.com/reference/android/content/Context.html` which can then be received using `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#context()`

This is called before `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#onLoadSdk(android.os.Bundle)` is invoked. No operations requiring a `https://developer.android.com/reference/android/content/Context.html` should be performed before then, as `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#context()` will return null until this method has been called.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | The new base context. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if a base context has already been set. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/sdksandbox/SandboxedSdkProvider.html#attachContext(android.content.Context)` |   |

### beforeUnloadSdk

Added in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19) Deprecated in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19)

```
public void [beforeUnloadSdk](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#beforeUnloadSdk())()
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

Does the work needed for the SDK to free its resources before being unloaded.

This function is called by the SDK sandbox manager before it unloads the SDK. The SDK should fail any invocations on the Binder previously returned to the client through `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkCompat#getInterface()`

The SDK should not do any long-running tasks here, like I/O and network calls.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/sdksandbox/SandboxedSdkProvider.html#beforeUnloadSdk()` |   |

### getContext

Added in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19) Deprecated in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19)

```
public final Context [getContext](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#getContext())()
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

Context previously set through `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#attachContext(android.content.Context)`. This will return null if no context has been previously set.

### onLoadSdk

Added in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19) Deprecated in [1.0.0-alpha19](https://developer.android.com/jetpack/androidx/releases/privacysandbox-sdkruntime#1.0.0-alpha19)

```
public abstract @NonNull SandboxedSdkCompat [onLoadSdk](https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat#onLoadSdk(android.os.Bundle))(@NonNull Bundle params)
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

Does the work needed for the SDK to start handling requests.

This function is called by the SDK sandbox after it loads the SDK.

SDK should do any work to be ready to handle upcoming requests. It should not do any long-running tasks here, like I/O and network calls. Doing so can prevent the SDK from receiving requests from the client. Additionally, it should not do initialization that depends on other SDKs being loaded into the SDK sandbox.

The SDK should not do any operations requiring a `https://developer.android.com/reference/android/content/Context.html` object before this method has been called.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html params` | list of params passed from the client when it loads the SDK. This can be empty. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkCompat` | Returns a `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkCompat`, passed back to the client. The IBinder used to create the `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/SandboxedSdkCompat` object will be used by the client to call into the SDK. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatException` | if initialization failed. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/sdksandbox/SandboxedSdkProvider.html#onLoadSdk(android.os.Bundle)` |   |