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

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

From source file:Main.java

public static boolean isBlePermission(Context context) {
    PackageManager pm = context.getPackageManager();
    boolean permission = (PackageManager.PERMISSION_GRANTED == pm
            .checkPermission("android.permission.BLUETOOTH", context.getPackageName()));
    return permission;
}

From source file:Main.java

public static String getAppInstaller(Context context, String packageName) {
    return context.getPackageManager().getInstallerPackageName(packageName);
}

From source file:Main.java

public static boolean isEmbeddedCar(Context context) {
    return context.getPackageManager().hasSystemFeature(FEATURE_AUTOMOTIVE);
}

From source file:Main.java

/** 
 * @return true if this device has a camera  
 *///from ww w . jav  a2  s. com
public static boolean hasCamera(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);
}

From source file:Main.java

public static List<ResolveInfo> queryIntents(Context context, Intent intent) {
    return context.getPackageManager().queryIntentActivities(intent, 0);

}

From source file:Main.java

/**
 * Determine weather the device has BLE.
 *
 * @param context  where from you determine if the device has BLE
 * @return True if the device has BLE./*from  ww  w. j  a  va2 s. c om*/
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static boolean hasBluetoothLE(final Context context) {
    return (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE));
}

From source file:Main.java

/**
 * @param context/*from w  ww .  j  av  a 2 s  . co 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 CharSequence getApplicationLabel(Context context) {
    PackageManager pm = context.getPackageManager();
    ApplicationInfo info = context.getApplicationInfo();
    CharSequence appLabel = pm.getApplicationLabel(info);
    return appLabel;
}

From source file:Main.java

public static boolean isMicrophoneAvailable(Context context) {
    final PackageManager pm = context.getPackageManager();
    return pm != null && pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE);
}