propoLis
propoLis

Reputation: 1283

How can I force to open only device camera for video capture intent?

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

Upvotes: 0

Views: 331

Answers (1)

Paresh
Paresh

Reputation: 6857

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.

Upvotes: 1

Related Questions