I have a custom camera application and I need to be able to turn flash on(torch mode actually)/off.
What kind of permission do I need in this case?
1.Only
<uses-feature android:name="android.hardware.camera"/>
<uses-permission android:name="android.permission.CAMERA"/>
2. Those from 1 plus:
<permission android:name="android.permission.FLASHLIGHT"
android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
android:protectionLevel="normal"/>
I think this is used when you want to use Flash, but without camera (like in this case: Android - Using Camera Flash)
3.Those from 1 plus:
<uses-permission android:name="android.hardware.camera.flash"/>
EDITED (thanks to @maclir):
Above line is incorrect. The correct one is:
<uses-permission android:name="android.permission.CAMERA"/>
developer.android.com: "Subfeature. The application uses the device camera's flash." (http://developer.android.com/guide/topics/manifest/uses-feature-element.html)
In all 3 cases, tested on 2 devices, works ok - I can activate/deactivate flash, but I want to be sure what exactly each of them means. It is weird that even without option 3 it is working ok...for what is than used option 3?
I think I'm missing something...
ANSWER
<uses-permission android:name="android.permission.CAMERA" />
is mandatory in order to use the camera (I'm not using camera via Intent, I have a customize camera app)
and:
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
are the camera specific features I use in the app.
android:required="false"
means Google Play will not prevent the application from being installed to devices that do not include these camera features - so the user having a device without camera and camera flash will be able to install the app from market.
http://developer.android.com/reference/android/hardware/Camera.html