Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device's camera supports flash.
Constant Value: "android.hardware.camera.flash"
Constant Value: "android.hardware.camera.flash"
1. Get a PackageManager Instance and save to myPackageManager.
2. Create a Boolean Variable named bolCameraFlashSupported.
3. Set the Minimum and Target SDK version to 7 or greater.
4. In the onCreate method, add the below code. This will return the Camera Flash ability to a boolean named bolCameraFlashSupported. It will then display a toast displaying the Camera Flash ability on the device to the user.
bolCameraFlashSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
if (bolCameraFlashSupported) {
Toast.makeText(this, "Device has Camera Flash ability", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No Camera Flash ability!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_CAMERA_FLASH
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_CAMERA_FLASH