TakePhotoContract

class TakePhotoContract @JvmOverloads constructor(val authority: String? = null) : ActivityResultContract<Any?, Uri?>

Taking photos from system camera.

When Build.VERSION.SDK_INT is between Build.VERSION_CODES.R and Build.VERSION_CODES.N, You need to refer to the following example configuration path for FileProvider.

// The output image path.
val path = Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES).path
<!-- File named file_paths.xml in xml folder. -->
<resources>
<!-- add this line -->
<external-path name="name_you_define" path="Pictures" />
</manifest>

Parameters

authority

The authority of a FileProvider defined in a element in your app's manifest. If your minimum SDK is greater than 30, no setting is required.

Constructors

Link copied to clipboard
constructor(authority: String? = null)

Properties

Link copied to clipboard
private val authority: String? = null
Link copied to clipboard
private var uri: Uri?

Functions

Link copied to clipboard
open override fun createIntent(context: Context, input: Any?): Intent
Link copied to clipboard
open override fun parseResult(resultCode: Int, intent: Intent?): Uri?