Partager via


SandboxedSdkProvider.AttachContext(Context) Method

Definition

Sets the SDK Context which can then be received using SandboxedSdkProvider#getContext().

[Android.Runtime.Register("attachContext", "(Landroid/content/Context;)V", "", ApiSince=34)]
public void AttachContext (Android.Content.Context context);
[<Android.Runtime.Register("attachContext", "(Landroid/content/Context;)V", "", ApiSince=34)>]
member this.AttachContext : Android.Content.Context -> unit

Parameters

context
Context

The new base context.

Attributes

Remarks

Sets the SDK Context which can then be received using SandboxedSdkProvider#getContext(). This is called before SandboxedSdkProvider#onLoadSdk is invoked. No operations requiring a Context should be performed before then, as SandboxedSdkProvider#getContext will return null until this method has been called.

Throws IllegalStateException if a base context has already been set.

Java documentation for android.app.sdksandbox.SandboxedSdkProvider.attachContext(android.content.Context).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to