Example usage for android.content Context getPackageManager

List of usage examples for android.content Context getPackageManager

Introduction

In this page you can find the example usage for android.content Context getPackageManager.

Prototype

public abstract PackageManager getPackageManager();

Source Link

Document

Return PackageManager instance to find global package information.

Usage

From source file:Main.java

public static boolean isFlashAvailable(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
}

From source file:Main.java

public static boolean supportsBluetoothLE(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
}

From source file:Main.java

public static boolean hasNfc(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC);
}

From source file:Main.java

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

From source file:Main.java

public static boolean isBleSupported(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
}

From source file:Main.java

public static boolean isSupportedBluetooth(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
}

From source file:Main.java

public static boolean checkBluetoothLeSupported(Context context) {
    if (context.getPackageManager().hasSystemFeature("android.hardware.bluetooth_le")) {
        return true;
    }/*  ww  w . jav  a2s  .  co  m*/
    return false;
}

From source file:Main.java

private static boolean haveReadLogsPermission(Context context) {
    return context.getPackageManager().checkPermission("android.permission.READ_LOGS",
            context.getPackageName()) == PackageManager.PERMISSION_GRANTED;
}

From source file:Main.java

public static PackageManager getPackageManager(Context context) {
    return context.getPackageManager();
}

From source file:Main.java

public static boolean isDeviceCompatible(Context context) {
    return context.getPackageManager() != null
            && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER)
            && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS);
}