PlatformContext

actual class PlatformContext

Android platform context that provides access to Android-specific context and activity.

Uses WeakReference for Activity to prevent memory leaks during long operations.

expect class PlatformContext

Represents a platform-specific context, providing access to platform-dependent resources and functionality.

This class is expected to be implemented separately for each platform where platform-specific dependencies and behavior can be injected.

Constructors

Link copied to clipboard
constructor(context: Context, activity: Activity? = null)
actual constructor()
expect constructor()

Properties

Link copied to clipboard

Current Activity. Returns null if Activity is not attached or destroyed.

Link copied to clipboard

Registry for handling activity results in a suspendable manner.

Link copied to clipboard
lateinit var context: Context

Functions

Link copied to clipboard

Check if Activity is currently available.

Link copied to clipboard
fun setActivity(activity: Activity?)

Set the current activity using WeakReference.