I am using intent to launch camera:
Intent cameraIntent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
getParent().startActivityForResu
API Level 29
I tried the accepted answer, but both Environment.getExternalStorageDirectory() used in the accepted answer and Environment.getExternalStoragePublicDirectory() used in a subsequent answer are deprecated in API level 29. So is the MediaStore.Images.Media.DATA used in the third answer deprecated in API level 29. The following code (in Kotlin) stores the full image in MediaStore as shown in this stackoverflow answer to a different question and doesn't rely on the FileProvider:
var imageUri: Uri? = null
fun takePhoto(view: View?) {
val values = ContentValues()
values.put(MediaStore.MediaColumns.DISPLAY_NAME, "myimage.jpg")
values.put(MediaStore.MediaColumns.MIME_TYPE, "image/jpeg")
values.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_PICTURES)
imageUri = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values)
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri)
startActivityForResult(intent, TAKE_PHOTO_REQUEST)
}