I had a problem: ACTION_IMAGE_CAPTURE behavior depends on the hardware manufacturer.
I think the best way to get a photo from a camera inserted in a photo gallery should look like this
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, CAPTURE_IMAGE_REQUEST);
and then get uri in onActivityResult:
switch (requestCode) {
case CAPTURE_IMAGE_REQUEST: {
if(resultCode == Activity.RESULT_OK) {
Uri uri = intent.getData();// content uri of photo in media gallery
//do something with this
}
break;
}
But I see that this does not work on many devices; Moreover, I found several different scenarios for the behavior of the Camera application:
- some devices have an error with this event, so there is no way to get full-size photos, and you can get a width of 512 pixels in tmp format only in the public directory
- ( ) , Uri. (getData() null, extras "define-data", value = true). temp, tempfile.
- -
- ,
, ?
, , uri .