Stay organized with collections
Save and categorize content based on your preferences.
SdkSandboxActivityHandler
interface SdkSandboxActivityHandler
This is used to notify the SDK when an Activity
is created for it.
When an SDK wants to start an Activity
, it should register an implementation of this class by calling android.app.sdksandbox.sdkprovider.SdkSandboxController#registerSdkSandboxActivityHandler(android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler)
that will return an android.os.IBinder
identifier for the registered SdkSandboxActivityHandler
to The SDK.
The SDK should be notified about the Activity
creation by calling android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler#onActivityCreated(android.app.Activity)
which happens when the caller app calls android.app.sdksandbox.SdkSandboxManager#startSdkSandboxActivity(Activity, IBinder)
using the same IBinder
identifier for the registered SdkSandboxActivityHandler
.
Summary
Public methods |
abstract Unit |
Notifies SDK when an Activity gets created.
|
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# SdkSandboxActivityHandler\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 7](https://developer.android.com/sdkExtensions)\n\nSdkSandboxActivityHandler\n=========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/sdksandbox/sdkprovider/SdkSandboxActivityHandler \"View this page in Java\") \n\n```\ninterface SdkSandboxActivityHandler\n```\n\n|-------------------------------------------------------------------|\n| [android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler](#) |\n\nThis is used to notify the SDK when an [Activity](../../Activity.html#) is created for it.\n\nWhen an SDK wants to start an [Activity](../../Activity.html#), it should register an implementation of this class by calling [android.app.sdksandbox.sdkprovider.SdkSandboxController#registerSdkSandboxActivityHandler(android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler)](/reference/kotlin/android/app/sdksandbox/sdkprovider/SdkSandboxController#registerSdkSandboxActivityHandler(android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler)) that will return an [android.os.IBinder](../../../os/IBinder.html#) identifier for the registered [SdkSandboxActivityHandler](#) to The SDK.\n\nThe SDK should be notified about the [Activity](../../Activity.html#) creation by calling [android.app.sdksandbox.sdkprovider.SdkSandboxActivityHandler#onActivityCreated(android.app.Activity)](#onActivityCreated(android.app.Activity)) which happens when the caller app calls [android.app.sdksandbox.SdkSandboxManager#startSdkSandboxActivity(Activity, IBinder)](../SdkSandboxManager.html#startSdkSandboxActivity(android.app.Activity,%20android.os.IBinder)) using the same [IBinder](../../../os/IBinder.html#) identifier for the registered [SdkSandboxActivityHandler](#).\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onActivityCreated](#onActivityCreated(android.app.Activity))`(`activity:` `[Activity](../../Activity.html#)`)` Notifies SDK when an [Activity](../../Activity.html#) gets created. |\n\nPublic methods\n--------------\n\n### onActivityCreated\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nabstract fun onActivityCreated(activity: Activity): Unit\n```\n\nNotifies SDK when an [Activity](../../Activity.html#) gets created.\n\nThis function is called synchronously from the main thread of the [Activity](../../Activity.html#) that is getting created.\n\nSDK is expected to call [Activity.setContentView(View)](../../Activity.html#setContentView(android.view.View)) to the passed [Activity](../../Activity.html#) object to populate the view.\n\nIf SDK registers lifecycle callbacks over the passed [Activity](../../Activity.html#) object using [android.app.Activity#registerActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks)](../../Activity.html#registerActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks)), it is important to note that [android.app.Application.ActivityLifecycleCallbacks#onActivityPreCreated(Activity, Bundle)](../../Application.ActivityLifecycleCallbacks.html#onActivityPreCreated(android.app.Activity,%20android.os.Bundle)) and [android.app.Application.ActivityLifecycleCallbacks#onActivityCreated(Activity, * Bundle)](../../Application.ActivityLifecycleCallbacks.html#onActivityCreated(android.app.Activity,%20android.os.Bundle)) will not be triggered as [onActivityCreated(android.app.Activity)](#onActivityCreated(android.app.Activity)) is called at the [Activity](../../Activity.html#) creation stage. Then to know about the Activity state, SDKs should override [android.app.Application.ActivityLifecycleCallbacks#onActivityPostCreated(Activity, * Bundle)](../../Application.ActivityLifecycleCallbacks.html#onActivityPostCreated(android.app.Activity,%20android.os.Bundle)).\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------------------------------|\n| `activity` | [Activity](../../Activity.html#): the [Activity](../../Activity.html#) gets created This value cannot be `null`. |"]]