Open frontal face camera in android

前端 未结 1 1078
南笙
南笙 2021-01-28 10:16

I\'m trying to open a frontal camera on my device but nothing that I try works and the back camera is always opening. I\'m using the LG G4 device.

    File file;         


        
1条回答
  •  南方客
    南方客 (楼主)
    2021-01-28 10:37

    You are assuming that an undocumented, unsupported Intent extra will be honored by all camera apps on all devices.

    There are ~2 billion Android devices, made up of thousands of device models. Those device models will ship with hundreds of different camera apps. Users can also install camera apps themselves. Any of those hundreds of camera apps may be what handles your ACTION_IMAGE_CAPTURE request. And none of them have to honor an android.intent.extras.CAMERA_FACING extra.

    You are welcome to put that extra on the Intent, and it is possible that there are camera apps that will pay attention to it. You should not assume that any camera will pay attention to it, and it will be up to the user to choose what camera to use for taking the picture.

    0 讨论(0)
提交回复
热议问题