createPhotoInExternalDir

fun createPhotoInExternalDir(context: Context): Result<File>

Creates a file for photo capture in the external pictures directory.

The file is created in the app-specific external pictures directory:

  • Primary: {externalFilesDir}/Pictures/STREAM_IMG_{timestamp}.jpg

  • Fallback: {cacheDir}/stream_cache/STREAM_IMG_{timestamp}.jpg (if external storage unavailable)

The file name includes a timestamp to ensure uniqueness.

Return

Result.Success with the created File, or Result.Failure with an error

Parameters

context

Android context for accessing storage directories