When my app runs on a Google Nexus 7 Tablet it returns false for this standard Android test to see if the device is equipped with a camera.
PackageManager pm = this.getPackageManager();
if(!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
// disable camera button
}
Now I realize that the Nexus 7 doesn't ship with a built in camera app, but when I do try to launch a camera activity I use the following (to give the user the option to pick alternate apps).
File fTempCameraFullDirPath = new File(msTempCameraFullDirPath);
Uri outputFileUri = Uri.fromFile( fTempCameraFullDirPath );
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult(Intent.createChooser(cameraIntent, getString(R.string.select_camera_app)), REQUEST_CODE_CAMERA);
Now clearly I don't get to this code because the test for a camera fails and I disable the button, but it seems like as long as I have a camera app installed on my Nexus 7 table that I should be able to take pictures.
Does anyone know of an alternate test that I can use to enable this functionality on this tablet (or similar devices)?
You can check for FEATURE_CAMERA_FRONT
, as the Nexus 7 only has a front-facing camera.
Try checking for PackageManager.FEATURE_CAMERA_FRONT
as well as FEATURE_CAMERA
, since the Nexus 7 only has the front-facing camera, and the Android camera selection algorithm defaults to the rear camera.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With