List of usage examples for android.content Context getPackageManager
public abstract PackageManager getPackageManager();
From source file:Main.java
public static boolean isDeviceSupportCamera(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { // this device has a camera return true; } else {/*from w w w .j a v a 2 s. c om*/ // no camera on this device return false; } }
From source file:Main.java
public static boolean isBleSupported(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { return true; } else {//from ww w .jav a 2 s. c o m return false; } }
From source file:Main.java
public static boolean isSupportBle(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) { return true; }//ww w . j a va 2s . c om return false; }
From source file:Main.java
public static boolean isHardwareAvailable(Context ctx, String type_hw) { return ctx.getPackageManager().hasSystemFeature(type_hw); }
From source file:Main.java
public static boolean checkCameraHardware(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { return true; } else {// w w w . ja v a 2 s . c o m Toast.makeText(context, "No camera on this device", Toast.LENGTH_SHORT).show(); return false; } }
From source file:Main.java
public static boolean checkBluetoothLeSupported(Context paramContext) { if (!paramContext.getPackageManager().hasSystemFeature("android.hardware.bluetooth_le")) { }//from www .j a v a2s. c o m for (boolean bool = false;; bool = true) { return bool; } }
From source file:Main.java
/** Check if this device has a camera */ public static boolean checkCameraHardware(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { // this device has a camera return true; } else {//from w ww.j av a 2 s. co m // no camera on this device return false; } }
From source file:Main.java
/** Check if this device has a camera */ public static boolean checkCameraHardwareIsPresent(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { // this device has a camera return true; } else {//from w w w . ja v a2s . c om // no camera on this device return false; } }
From source file:Main.java
public static void startAPP(String appPackageName, Context context) { Intent intent = context.getPackageManager().getLaunchIntentForPackage(appPackageName); context.startActivity(intent);// w w w . j av a 2s. c o m }
From source file:Main.java
public static void startXiaomiApp(Context context) { Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.xiaomi.smarthome"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//from w w w . j av a 2 s.co m }