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 checkForCamera(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA))
        return true;
    else//  w  w w .  ja  va 2s .  co m
        return false;

}

From source file:Main.java

public static List<PackageInfo> getInsatalledPackages(Context context) {
    return context.getPackageManager().getInstalledPackages(0);
}

From source file:Main.java

public static boolean checkForFrontCam(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) {
        return true;
    } else {//from w  ww  . j a  v a 2  s  .c  o m
        return false;
    }
}

From source file:Main.java

public static boolean isSupportBluetooth(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
        return true;
    }/*from  www  .  java2 s.  co m*/
    return false;
}

From source file:Main.java

public static final boolean Camera_checkHardware(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        return true;
    } else {//w w w  . java 2s.  c  o m
        return false;
    }
}

From source file:Main.java

/**
 * Check whether device support ble.//  w  ww .j  av a2  s.c o  m
 * 
 * @param context Activity context
 * @return whether device support ble
 */
public static boolean CheckBleSupport(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
}

From source file:Main.java

/**
 * Helper function to check if this app and device is able to make call
 *
 * @param context should be an Activity context
 *//* w  w  w .  j  a v  a2 s. c  o m*/
public static boolean isTelephonyAvailable(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
}

From source file:Main.java

public static void restartApp(Context context) {
    Intent i = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(i);//from  w ww .java2s .  c  o m
}

From source file:Main.java

/**
 * @param context invoking context//from  ww  w.  ja v  a  2  s .c o  m
 * @return info about does device support Camera
 */
public static boolean isDeviceSupportCamera(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);

}

From source file:Main.java

public static boolean isGoogleTV(final Context theContext) {
    return theContext.getPackageManager().hasSystemFeature("com.google.android.tv");
}