List of usage examples for android.content.pm PackageManager hasSystemFeature
public abstract boolean hasSystemFeature(String name);
From source file:Main.java
public static boolean hasMicrophone(Activity activity) { PackageManager packageManager = activity.getPackageManager(); return packageManager.hasSystemFeature(PackageManager.FEATURE_MICROPHONE); }
From source file:Main.java
public static boolean isCameraUseAble(Context context) { PackageManager packageManager = context.getPackageManager(); return packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA); }
From source file:Main.java
public static boolean checkCameraHardWare(Context context) { PackageManager packageManager = context.getPackageManager(); if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) { return true; }//ww w .j av a 2 s . c o m return false; }
From source file:Main.java
/** * Checking for network support/* www .j a v a 2 s . c om*/ * * @param ctx : context to be passed * @return : true is network support is available. */ public static final boolean hasNetworkSupport(Context ctx) { PackageManager packageManager = ctx.getPackageManager(); return (packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_NETWORK)); }
From source file:Main.java
/** * Test if this device is a Google TV./*from www . ja v a 2s .c om*/ * * See 32:00 in "Google I/O 2011: Building Android Apps for Google TV" * http://www.youtube.com/watch?v=CxLL-sR6XfM * * @return true if google tv */ public static boolean isGoogleTV(Context context) { final PackageManager pm = context.getPackageManager(); return pm.hasSystemFeature("com.google.android.tv"); }
From source file:Main.java
public static boolean hasCamera(Context context) { PackageManager packageManager = context.getPackageManager(); if (!packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) { return false; }/* w w w .j ava2 s . c om*/ return true; }
From source file:Main.java
public static boolean hasCamera(Context context) { if (context == null || context.getPackageManager() == null) { throw new IllegalArgumentException("Context and package manager must not be null"); }//from w w w .j a v a 2 s. c om PackageManager pm = context.getPackageManager(); if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) { return true; } else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT); } else { return false; } }
From source file:Main.java
public static boolean isMicrophoneAvailable(Context context) { final PackageManager pm = context.getPackageManager(); return pm != null && pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE); }
From source file:Main.java
/** * Function to check if the device has a camera or not. * @param context context of class./* w ww. jav a2 s .co m*/ * @return true if the camera is present and false otherwise. */ public static boolean isCameraPresent(Context context) { PackageManager packageManager = context.getPackageManager(); return packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA) || packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT); }
From source file:Main.java
/** * Checks if this device supports SMS.// w w w .j ava 2 s . co m * * @param context the Android context. * @return true if this device is SMS capable; false otherwise. */ public static boolean isSmsSupported(Context context) { PackageManager manager = context.getPackageManager(); if (manager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { return true; } return false; }