3

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>
Victor S
  • 4,021
  • 15
  • 43
  • 54

1 Answers1

3

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

Ankitkumar Makwana
  • 3,475
  • 3
  • 19
  • 45