Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine an android device whether supports "android.hardware.camera.autofocus"?

How to determine an android device whether supports "android.hardware.camera.autofocus"?

From where I can get a feature list supported by this android device?

I want to use feature in my app, but I don't know if the phone supports or not.

<uses-feature
    android:name="android.hardware.camera"
    >
</uses-feature>
<uses-feature
    android:name="android.hardware.camera.autofocus"
    android:required="true"
    >
</uses-feature>
like image 449
Victor S Avatar asked Jan 31 '26 04:01

Victor S


1 Answers

you can manage like

PackageManager pm = getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
// Here if you get Camera Do you work Like

Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(MediaStore.EXTRA_OUTPUT,MyFileContentProvider.CONTENT_URI);
startActivityForResult(i, CAMERA_RESULT);

 } else {
Toast.makeText(getBaseContext(), "Camera is not available",Toast.LENGTH_LONG).show();
}

also Add Require Permission of Camera to AndroidManifest.xml file

like image 120
Ankitkumar Makwana Avatar answered Feb 01 '26 19:02

Ankitkumar Makwana