I am running into a problem when launching a camera intent when targeting Android 33 and running on Android 33.
I am using a file provider to create and pass a file to the camera
Manifest:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
filepaths:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="attachments" path="attachments/"/>
<cache-path name="geopackage" path="geopackage/"/>
<external-files-path name="pictures" path="Pictures"/>
<external-files-path name="videos" path="Movies"/>
<external-files-path name="audio" path="Music"/>
</paths>
Permissions request
private val requestImagePermission = registerForActivityResult(
ActivityResultContracts.RequestPermission()
) { result ->
this.onPermission(result)
}
Image request
private val getImage = registerForActivityResult(
ActivityResultContracts.TakePicture()
) { status ->
onMediaResult(status)
}
Launch camera intent
private fun launchCameraIntent() {
val file = File.createTempFile(
UUID.randomUUID().toString(),
".jpg",
getExternalFilesDir(Environment.DIRECTORY_PICTURES)
)
val uri = FileProvider.getUriForFile(applicationContext, applicationContext.packageName + ".fileprovider", file)
currentMediaPath = file.absolutePath
getImage.launch(uri)
}
I am prompted for camera permission and accept. However upon launch of the camera I get:
Permission needed. To use camera, turn on Camera, Microphone, and Storage permissions.
Using the old permissions API this worked just fine when asking for just the Camera permission and storage permission. However I was under the impression that storing in getExternalFilesDir you did not need to ask for storage permission.
Any ideas?

Correct. However, that dialog is not from the platform, but from that particular camera app. They probably did not take into account the
ACTION_IMAGE_CAPTURE/ActivityResultContracts.TakePicturescenario, where it is the responsibility of the caller to supply a location that is writeable.