Example usage for android.content.pm PackageManager FEATURE_CAMERA

List of usage examples for android.content.pm PackageManager FEATURE_CAMERA

Introduction

In this page you can find the example usage for android.content.pm PackageManager FEATURE_CAMERA.

Prototype

String FEATURE_CAMERA

To view the source code for android.content.pm PackageManager FEATURE_CAMERA.

Click Source Link

Document

Feature for #getSystemAvailableFeatures and #hasSystemFeature : The device has a camera facing away from the screen.

Usage

From source file:Main.java

public static boolean isCameraAvailable(Context context) {
    PackageManager pm = context.getPackageManager();
    return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA);
}

From source file:Main.java

public static boolean isCameraPresent(Context context) {
    boolean hasCamera = false;
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        hasCamera = true;/*  w w w  .j  a v a 2 s.  co  m*/
    }
    return hasCamera;
}

From source file:Main.java

public static boolean isSupportCameraHardware(Context context) {
    if (context != null && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        // this device has a camera
        return true;
    } else {/*from  w w  w .  ja  va  2s  . co  m*/
        // no camera on this device
        return false;
    }
}

From source file:Main.java

public static boolean deviceHasCamera(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);
}

From source file:Main.java

public static boolean checkCameraAvailability(Context context) {
    PackageManager pm = context.getPackageManager();

    if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        return true;
    }/* w w  w .j ava  2 s.  c  o  m*/

    return false;
}

From source file:Main.java

/** Check if this device has a camera */
public static boolean checkCameraHardware(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        // this device has a camera
        return true;
    } else {//  w ww .  j  a v  a  2s  .c  o m
        // no camera on this device
        return false;
    }
}

From source file:Main.java

public static boolean checkCameraHardWare(Context context) {
    PackageManager packageManager = context.getPackageManager();
    if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        return true;
    }//from w  ww  .j  a  v  a 2  s. co m
    return false;
}

From source file:Main.java

@SuppressLint("NewApi")
public static boolean checkCameraHardware(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        // this device has a camera
        return true;
    } else {//from  w  ww  .j av  a  2s.co m
        // no camera on this device
        return false;
    }
}

From source file:Main.java

public static boolean checkCameraHardware(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        return true;
    } else {//ww w  . ja  v a2  s. c om
        Toast.makeText(context, "No camera on this device", Toast.LENGTH_SHORT).show();
        return false;
    }
}

From source file:Main.java

public static boolean isCameraUseAble(Context context) {
    PackageManager packageManager = context.getPackageManager();
    return packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA);
}