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); 
  • I had a similar problem. The solution was very simple. If it helps in your case, then I will be glad. Do you start as an intent? startActivity(intent); ? Try this: startActivity(Intent.createChooser(intent,"Choose your camera")); - Egor Randomize
  • Was there any real statistics on your decision? There are suspicions that the decision will not help. Sometimes, for example, Intent opens the camera correctly and the camera crashes already at the stage of saving photos (Samsung GT-S7262 (4.1.2), Google Nexus 6P (8.1), Blu Studio S530 (4.4.2)) when they removed CAMERA_FACING - the bug disappeared. That is, the way the camera was chosen is not always decisive - Arderun
  • My application crashed on some versions of Android. I had an intent to view the file through the gallery, and my decision helped me. Now it doesn't crash - Egor Randomize

0