We implement camera with intent it's working fine in micromax480p version 5.1 but when we used in Nexus7 version 6.1 by that time camera is opened but i want to open some times Front and somr times Back is it possible to open according to as we need.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
//intent.addCategory(Intent.CATEGORY_OPENABLE);
//intent.setAction(Intent.ACTION_GET_CONTENT);
if(camera == 1) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("android.intent.extras.CAMERA_FACING", android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1);
intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
} else {
intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
}
}
// start the image capture Intent
startActivityForResult(intent, requestCode);
I used like this but it's open defaultly what ever we used camera(front and back) previously.thanks. sorry for my weak English comm.