For this you should do like :
-
Check whether flash light isavailable or not ?
-
If yes then Turn Off/On
-
If no then you can do whatever according to your app.needs
For Checking availability of flash in device:
You can use the following
?context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)
which will return true if a flash is available,false if not.
See http://developer.android.com/reference/android/content/pm/PackageManager.html for more information.
??? <uses-permission android:name="android.permission.CAMERA" /> ??? <uses-feature android:name="android.hardware.camera" /> ??? <uses-feature android:name="android.hardware.camera.autofocus" />