Android - Start front camera to capture by Intent

381 Views Asked by At

I tried other questions' methods, but for me, these methods do not work .

I want to use intent to start front camera. I try to do it

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extras.CAMERA_FACING",1);
mFile = Utils.getVisitorImage();
Uri imageUri = FileProvider.getUriForFile(
                getActivity(),
                getActivity().getPackageName() + ".fileprovider",
                mFile);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, CAMERA_PHOTO_REQUEST_CODE);

but,it does't work. my device is Android 7.1.1 or some device higher 6.0.1.

How to use intent start front camera? I hope someone help me.Thanks.

0

There are 0 best solutions below