0

When I capture video by using the camera intent, user can select all camera applications. But I want to force the user to turn on only the device camera. How can I do that?

My current intent : Intent captureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

private void captureVideo() {
    Intent captureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    if (captureIntent.resolveActivity(conversationActivity.getPackageManager()) != null) {
        if (captureVideoUri == null) {
            captureVideoUri = Uri.fromFile(CameraHelper.getOutputMediaFile(CameraConfiguration.MEDIA_ACTION_VIDEO));
        }
        captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, captureVideoUri);
    }
    startActivityForResult(captureIntent, 1);
}

enter image description here

propoLis
  • 1,229
  • 1
  • 14
  • 48

1 Answers1

1

I want to force the user to turn on only the device camera. How can I do that?

You can open specific app by defining setClassName (String packageName, String className). But I don't think that is a right way because if you are not developing the app that is device specific, You might get into problem.

Reason is - Every device will not have the same camera app, so that, application_full_class_name does not lend to that specific app everytime. It may throw ActivityNoFoundException as well.

Paresh P.
  • 6,677
  • 1
  • 14
  • 26