-
public final class CaptureMediaLauncherKt
-
-
Method Summary
Modifier and Type Method Description final static ManagedActivityResultLauncher<Unit, File>rememberCaptureMediaLauncher(Boolean photo, Boolean video, Function1<File, Unit> onResult)Creates and remembers a process-death-safe launcher for capturing media (photo and/or video) using the device camera. -
-
Method Detail
-
rememberCaptureMediaLauncher
@Composable() final static ManagedActivityResultLauncher<Unit, File> rememberCaptureMediaLauncher(Boolean photo, Boolean video, Function1<File, Unit> onResult)
Creates and remembers a process-death-safe launcher for capturing media (photo and/or video) using the device camera.
Destination file paths are persisted via rememberSaveable. When the hosting activity is destroyed and recreated (e.g. under "Don't keep activities"), the paths are restored on the CaptureMediaContract before the pending result is delivered, ensuring the captured file is correctly resolved.
- Parameters:
photo- Iftrue, enables photo capture capability.video- Iftrue, enables video capture capability.onResult- Callback invoked when media capture completes successfully.
-
-
-
-