How to open only default camera without showing chooser in Android

In some cases you might want to open only default camera of the device without showing chooser of 3rd party camera applications. You can try following code, its working perfectly fine in my case.

PackageManager packageManager = context.getPackageManager();

List<ApplicationInfo> list = packageManager
for (int n = 0; n < list.size(); n++) {
	if ((list.get(n).flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
		if (list.get(n).loadLabel(packageManager).toString()
					.equalsIgnoreCase("Camera")) {
			defaultCameraPackage = list.get(n).packageName;

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

Using above code you are filtering package of device default camera and then setting package in intent. I’ve tested it by installing two application Line Camera and Paper Camera both apps were showing chooser but filtering by package as in above code will open only default camera. If you’ve better solution please share your thoughts here.

Leave a Comment

Your email address will not be published. Required fields are marked *