Example usage for android.content.pm PackageManager hasSystemFeature

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

Introduction

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

Prototype

public abstract boolean hasSystemFeature(String name);

Source Link

Document

Check whether the given feature name is one of the available features as returned by #getSystemAvailableFeatures() .

Usage

From source file:Main.java

public static boolean deviceHasCamera(final PackageManager packageManager) {
    if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        return true;
    }//w w  w  .j a va 2  s .  c  om

    return false;
}

From source file:Main.java

public static boolean hasGPSFeature(Context c) {
    PackageManager pm = c.getPackageManager();
    if (pm.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)) {
        return true;
    }//from ww w  . j  a v  a 2 s .  com
    return false;
}

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

private static boolean isFlashSupported(Context context) {
    PackageManager pm = context.getPackageManager();
    return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

/**
 * @param context/*  w w w  .j  av  a 2s .  c  o  m*/
 *         the application context
 * @return true if the device has a front camera, false else
 */
public static boolean hasCameraFront(Context context) {
    PackageManager pm = context.getPackageManager();
    return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
}

From source file:Main.java

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

    if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        return true;
    }/*from w  w w. j  a v a  2  s.  c  om*/

    return false;
}

From source file:Main.java

public static boolean isFrontCameraSupported(Context ctx) {
    PackageManager pm = ctx.getPackageManager();
    return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
}

From source file:Main.java

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