LocalEnvironmentOwner
object LocalEnvironmentOwner
Provides an AndroidEnvironment for interacting with the current native or mock environment.
This has to be used with a NativeAndroidEnvironment or MockAndroidEnvironment. For the mock one, an additional ActivityResultRegistryOwner will be provided to intercept the Bluetooth permission requests made using rememberLauncherForActivityResult.
Example:
val environment = MockAndroidEnvironment.Api31(
isBluetoothConnectPermissionGranted = false,
isBluetoothScanPermissionGranted = false,
)
CompositionLocalProvider(values = LocalEnvironmentOwner provides environment) {
Content(
environment = LocalEnvironmentOwner.current,
)
}Content copied to clipboard
See also
Functions
Link copied to clipboard
Associates a LocalEnvironmentOwner key to one or more values in a call to CompositionLocalProvider.