List of usage examples for android.content Context getPackageManager
public abstract PackageManager getPackageManager();
From source file:Main.java
/** * if device phone supports the ble/*w w w . jav a 2 s . c o m*/ */ public static boolean isSupportBle(Context context) { if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) { System.out.println("CAN NOT SUPPORT BLE"); return false; } else { return true; } }
From source file:Main.java
@SuppressLint("NewApi") public static boolean checkCameraHardware(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { // this device has a camera return true; } else {//from ww w . j a va2 s.co m // no camera on this device return false; } }
From source file:Main.java
public static boolean wasInstalledFromGooglePlay(Context context) { String installer = context.getPackageManager().getInstallerPackageName(context.getPackageName()); return "com.android.vending".equals(installer); }
From source file:Main.java
public static boolean isPackageOk(Context context, String path) { return context.getPackageManager().getPackageArchiveInfo(path, PackageManager.GET_ACTIVITIES) != null; }
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
public static boolean isGoogleTV(Context context) { return context.getPackageManager().hasSystemFeature("com.google.android.tv"); }
From source file:Main.java
public static boolean hasMicrophone(Context context) { return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE); }
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 hasGPSFeature(Context c) { PackageManager pm = c.getPackageManager(); if (pm.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)) { return true; }/*from w w w .ja va2 s . com*/ return false; }