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 device that can perform this function but would like my app to only use the default camera.
Is there a way of doing this?
As Dr_sulli suggested, i am just converting it into a code and it works for me well, If case to access direct camera application and else part is allow the user to choose other camera applications along with system camera.
inside onActivityResult do your stuff
isPackageExists will confirm the package exist or not.
OR you can do it in my way its much easier, this will filter the all system application and then later you compare the name hence it work on all phone but the above technique due to hard coding will not work on every phone. Later you can use this package name to start the camera activity as i described above.
the default camera app is the first app was installed. So, the first element in camlist is the default app
I find following solution and its working perfectly.
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.
I'm not sure what you are trying to accomplish is portable across all devices. One goal of Android is to allow the easy replacement of activities that service requests such as image capture. That being said, if you only wish to do this for your device, you could simply set the component name in the intent to the media capture activity's name.
I have prepared a solution which works in almost all solution:
You may need to put following code in onCreate method: