Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [Ad Services Extensions 7](https://developer.android.com/sdkExtensions)   
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# SdkSandboxActivityHandler

*** ** * ** ***

` public interface SdkSandboxActivityHandler `   
` `

|---|
| android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler |

<br />

*** ** * ** ***

<br />

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

The SDK sandbox is no longer supported.

This is used to notify the SDK when an `https://developer.android.com/reference/android/app/Activity` is created for it.

When an SDK wants to start an `https://developer.android.com/reference/android/app/Activity`, it should register an implementation of this class by calling `https://developer.android.com/reference/android/app/sdksandbox/sdkprovider/SdkSandboxController#registerSdkSandboxActivityHandler(android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler)` that will return an `https://developer.android.com/reference/android/os/IBinder` identifier for the registered `https://developer.android.com/reference/android/app/sdksandbox/sdkprovider/SdkSandboxActivityHandler` to The SDK.

The SDK should be notified about the `https://developer.android.com/reference/android/app/Activity` creation by calling `https://developer.android.com/reference/android/app/sdksandbox/sdkprovider/SdkSandboxActivityHandler#onActivityCreated(android.app.Activity)` which happens when the caller app calls `https://developer.android.com/reference/android/app/sdksandbox/SdkSandboxManager#startSdkSandboxActivity(android.app.Activity,%20android.os.IBinder)` using the same `https://developer.android.com/reference/android/os/IBinder` identifier for the registered `https://developer.android.com/reference/android/app/sdksandbox/sdkprovider/SdkSandboxActivityHandler`.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/app/sdksandbox/sdkprovider/SdkSandboxActivityHandler#onActivityCreated(android.app.Activity)(https://developer.android.com/reference/android/app/Activity activity) ` Notifies SDK when an `https://developer.android.com/reference/android/app/Activity` gets created. |

## Public methods

### onActivityCreated

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [Ad Services Extensions 7](https://developer.android.com/sdkExtensions)   
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onActivityCreated (Activity activity)
```

Notifies SDK when an `https://developer.android.com/reference/android/app/Activity` gets created.

This function is called synchronously from the main thread of the `https://developer.android.com/reference/android/app/Activity` that is getting created.

SDK is expected to call `https://developer.android.com/reference/android/app/Activity#setContentView(android.view.View)` to the passed `https://developer.android.com/reference/android/app/Activity` object to populate the view.

If SDK registers lifecycle callbacks over the passed `https://developer.android.com/reference/android/app/Activity` object using `https://developer.android.com/reference/android/app/Activity#registerActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks)`, it is important to note that `https://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks#onActivityPreCreated(android.app.Activity,%20android.os.Bundle)` and `https://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks#onActivityCreated(android.app.Activity,%20android.os.Bundle)` will not be triggered as `https://developer.android.com/reference/android/app/sdksandbox/sdkprovider/SdkSandboxActivityHandler#onActivityCreated(android.app.Activity)` is called at the `https://developer.android.com/reference/android/app/Activity` creation stage. Then to know about the Activity state, SDKs should override `https://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks#onActivityPostCreated(android.app.Activity,%20android.os.Bundle)`.

<br />

| Parameters ||
|---|---|
| `activity` | `Activity`: the `https://developer.android.com/reference/android/app/Activity` gets created. This value cannot be `null`. <br /> |