SandboxedSdkProviderCompat


abstract class SandboxedSdkProviderCompat


Compat version of android.app.sdksandbox.SandboxedSdkProvider.

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.

Summary

Public constructors

Public functions

Unit

Sets the SDK Context which can then be received using SandboxedSdkProviderCompat.context

open Unit

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

abstract View
getView(windowContext: Context, params: Bundle, width: Int, height: Int)

Requests a view to be remotely rendered to the client app process.

abstract SandboxedSdkCompat
onLoadSdk(params: Bundle)

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

Public properties

Context?

Context previously set through SandboxedSdkProviderCompat.attachContext.

Public constructors

SandboxedSdkProviderCompat

Added in 1.0.0-alpha14
SandboxedSdkProviderCompat()

Public functions

attachContext

Added in 1.0.0-alpha14
fun attachContext(context: Context): Unit

Sets the SDK Context which can then be received using SandboxedSdkProviderCompat.context

This is called before SandboxedSdkProviderCompat.onLoadSdk is invoked. No operations requiring a Context should be performed before then, as SandboxedSdkProviderCompat.context will return null until this method has been called.

Parameters
context: Context

The new base context.

Throws
kotlin.IllegalStateException

if a base context has already been set.

See also
attachContext

beforeUnloadSdk

Added in 1.0.0-alpha14
open fun beforeUnloadSdk(): Unit

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 SandboxedSdkCompat.getInterface

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

See also
beforeUnloadSdk

getView

Added in 1.0.0-alpha14
abstract fun getView(windowContext: Context, params: Bundle, width: Int, height: Int): View

Requests a view to be remotely rendered to the client app process.

See also
getView

onLoadSdk

Added in 1.0.0-alpha14
abstract fun onLoadSdk(params: Bundle): SandboxedSdkCompat

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 Context object before this method has been called.

Parameters
params: Bundle

list of params passed from the client when it loads the SDK. This can be empty.

Returns
SandboxedSdkCompat

Returns a SandboxedSdkCompat, passed back to the client. The IBinder used to create the SandboxedSdkCompat object will be used by the client to call into the SDK.

See also
onLoadSdk

Public properties

context

Added in 1.0.0-alpha14
val contextContext?

Context previously set through SandboxedSdkProviderCompat.attachContext. This will return null if no context has been previously set.