Faced the problem that the network has about a dozen moderately similar ways to call the native front of the camera and almost none of them work for all android phones. Did someone successfully create a similar query? (Tested on production or serious testing for many phones)
For example, add two options obviously not correct. I do not want to litter the issue with examples.
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1); } else { intent.putExtra("android.intent.extras.CAMERA_FACING", 1); } or
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 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);
startActivity(intent);? Try this:startActivity(Intent.createChooser(intent,"Choose your camera"));- Egor Randomize