Can I force my application to launch the default Camera rather than offering the 'Complete action using' list?

前端 未结 5 647
一个人的身影
一个人的身影 2021-01-05 23:29

I\'m using the intent new Intent(MediaStore.ACTION_IMAGE_CAPTURE); to capture an image for use in my application. I have two applications installed on my de

5条回答
  •  青春惊慌失措
    2021-01-06 00:07

        List list = packageManager.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
        for (int n=0;n

    I find following solution and its working perfectly.

    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    takePictureIntent.setPackage(defaultCameraPackage); 
    startActivityForResult(takePictureIntent, actionCode);
    

    you can filter default camera by setting package in above intent. I've tested it by installing two application Line Camera and Paper Camera both apps were showing chooser but filtering by package above code open only default camera.

提交回复
热议问题