Android Utililty Methods Camera Check

List of utility methods to do Camera Check

Description

The list of methods to do Camera Check are organized into topic(s).

Method

voidthrowIfCameraDisabled(Activity activity)
throw If Camera Disabled
DevicePolicyManager dpm = (DevicePolicyManager) activity
        .getSystemService(Context.DEVICE_POLICY_SERVICE);
if (dpm.getCameraDisabled(null)) {
    throw new CameraDisabledException();
booleanisCameraFlashSupported(Context context)
is Camera Flash Supported
return context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA_FLASH);
booleanisCameraSupported(Context context)
is Camera Supported
return context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA);
booleanisPortrait(Context context)
is Portrait
return (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
booleancheckCameraHardware(Context context)
Check if this device has a camera
if (context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA)) {
    return true;
} else {
    return false;
booleancheckCameraHardware(Context context)
Detecting camera hardware
if (context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA)) {
    return true;
} else {
    return false;
booleancheckCameraHardware(Context context)
check Camera Hardware
if (context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA)) {
    return true;
} else {
    return false;
booleancheckCameraHardware(Context context)
Check if this device has a camera
if (context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA)) {
    return true;
} else {
    return false;
booleancheckFrontCamera(Context context)
Check if this device has front camera
if (context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA_FRONT)) {
    return true;
} else {
    return false;
booleandeviceHasCamera(Context context)
device Has Camera
return context.getPackageManager().hasSystemFeature(
        PackageManager.FEATURE_CAMERA);