如何强制Android Camera应用使用后置摄像头?

问题描述

我有一个名为openCamera功能,该功能创建并开始使用Android的相机应用程序拍照。这是代码

private fun openCamera() {
    Intent(MediaStore.ACTION_IMAGE_CAPTURE).also { takePictureIntent ->
        // 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 + ".provider",photoFile
                )
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,photoURI)
                startActivityForResult(takePictureIntent,CAMERA_REQUEST_CODE)
            }
        }
    }
}

当我的应用程序打开相机应用程序时,如何强制使用后置摄像头而不是前置摄像头打开相机应用程序?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)