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 getPermission(String permission, Context context) {
    PackageManager pm = context.getPackageManager();
    return PackageManager.PERMISSION_GRANTED == pm.checkPermission(permission, "com.example.renrenstep");
}

From source file:Main.java

public static void clearMyDefaultBrowser(Context context) {
    PackageManager pm = context.getPackageManager();
    pm.clearPackagePreferredActivities(context.getPackageName());
}

From source file:Main.java

public static void clearDefaultOpenSetting(Context mContext) {
    PackageManager pm = mContext.getPackageManager();
    pm.clearPackagePreferredActivities(mContext.getPackageName());
}

From source file:Main.java

public static String getAppName(Context context) {
    PackageManager pm = context.getPackageManager();
    String appName = context.getApplicationInfo().loadLabel(pm).toString();
    return appName;
}

From source file:Main.java

public static String getAppName(Context mContext) {
    PackageManager pm = mContext.getPackageManager();
    return mContext.getApplicationInfo().loadLabel(pm).toString();
}

From source file:Main.java

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

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

/** Check if this device has a camera */
private static boolean checkCameraHardware(Context context) {
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        // this device has a camera
        return true;
    } else {/* w ww. j av  a 2s .  c om*/
        // no camera on this device
        Log.d(TAG, "no camera on this device");
        return false;
    }
}

From source file:Main.java

/**
 * Check if this device has a camera/*w w  w  .java  2 s  . c om*/
 */
public static boolean checkCameraHardware(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);
}

From source file:Main.java

public static boolean isEditorInstalled(Context ctx) {
    try {/*ww  w.  j av a  2  s .c o m*/
        ctx.getPackageManager().getPackageInfo("net.fhtagn.zoobeditor", 0);
        return true;
    } catch (NameNotFoundException e) {
        return false;
    }
}