title: How do I force Android Camera app to use back camera?
body: <p>I have a function called <code>openCamera</code> that creates and starts an intent to take a photo with Android's camera app. This is the code:</p>
  <pre><code>private fun openCamera() {
      Intent(MediaStore.ACTION_IMAGE_CAPTURE).also { takePictureIntent -&gt;
          // Ensure that there's a camera activity to handle the intent
          takePictureIntent.resolveActivity(packageManager)?.also {
              // Create the File where the photo should go
              photoFile = createImageFile()
  
              // Continue only if the File was successfully created
              photoFile.also {
                  photoURI = FileProvider.getUriForFile(
                      Objects.requireNonNull(applicationContext),
                      BuildConfig.APPLICATION_ID + &quot;.provider&quot;,
                      photoFile
                  )
                  takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)
                  startActivityForResult(takePictureIntent, CAMERA_REQUEST_CODE)
              }
          }
      }
  }
  </code></pre>
  <p>When my app opens the camera app, how do I force the camera app to open using the back camera instead of the front camera?</p>