I know is possible to detect if camera has flash integrated, using a method like this:
/**
* @return true if a flash is available, false if not
*/
public
I figured this by myself and I post here the solution, which is actually very simple:
/**
* Check if Hardware Device Camera can use Flash
* @return true if can use flash, false otherwise
*/
public static boolean hasCameraFlash(Camera camera) {
Camera.Parameters p = camera.getParameters();
return p.getFlashMode() == null ? false : true;
}
The above method is different by this one:
/**
* Checking availability of flash in device.
* Obs.: If device has 2 cameras, this method doesn't ensure both cameras can use flash.
* @return true if a flash is available in device, false if not
*/
public static boolean isFlashAvailable(Context context) {
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
}