Reputation: 8448
Using this code, I start the Andorid camera:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
// start the image capture Intent
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
But this code opens back camera. Is it possible to launch the Intent
in order to open the front camera?
Upvotes: 1
Views: 2770
Reputation: 30611
You could try using
intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
The caveat with this answer is that the camera app is not the same on all devices, and in many devices the default camera app is developed by the OEM. So this is more of a workaround really. I believe the front camera does not have a concrete API because many apps could potentially abuse it for spying and other purposes.
Upvotes: 2