captureAsyncAndShare

suspend fun CaptureController.captureAsyncAndShare(context: Context, type: ImageType = ImageType.PNG(100), addOptionChooseIntent: (chooseIntent: Intent) -> Unit = {}, authority: String = context.packageName + ".fileprovider", deleteOnExit: Boolean = true): Result<Unit>

Capture and share Image

capture and saveTo Cache Folder then make Intent.ACTION_SEND For share

also see CaptureController.captureAsync

Example usage:

val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()
val context = LocalContext.current

// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(
onClick = {
scope.launch {
captureController.captureAsyncAndShare(
context = context
)
}
}) { ... }

Parameters

context

Context

type

Share Type PNG or JPEG ImageType

authority

Need For get contentUri default value : (com.your.package).fileprovider

addOptionChooseIntent
deleteOnExit

clear temp file when exit app

suspend fun <Error class: unknown class>.captureAsyncAndShare(fileName: String = "capture_shared", metaTitle: String = "Share Captured Image", type: ImageType = ImageType.PNG(100), addOptionUIActivityViewController: (UIActivityViewController) -> Unit = {}, topViewController: UIViewController? = UIApplication.sharedApplication.keyWindow?.rootViewController): <Error class: unknown class>

Capture and share Image

capture and saveTo platform.Foundation.NSTemporaryDirectory then make UIActivityViewController For share

also see CaptureController.captureAsync

Example usage:

val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()

// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(
onClick = {
scope.launch {
captureController.captureAsyncAndShare()
}
}) { ... }

Parameters

fileName

save temp File name default value : "capture_shared"

metaTitle

title of UIActivityViewController meta default value : "Share Captured Image"

type

Share Type PNG or JPEG ImageType

addOptionUIActivityViewController

add option if need for UIActivityViewController

topViewController

The topViewController where UIActivityViewController will be presented. By default, it retrieves the top rootViewController.