Paul Paul - 1 year ago 72
Android Question

What permission I need in order to use camera flash in camera preview?

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?


<uses-feature android:name=""/>
<uses-permission android:name="android.permission.CAMERA"/>

Those from 1 plus:

<permission android:name="android.permission.FLASHLIGHT"

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=""/>

EDITED (thanks to @maclir):

Above line is incorrect. The correct one is:

<uses-permission android:name="android.permission.CAMERA"/> "Subfeature. The application uses the device camera's flash." (

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...


<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)


<uses-feature android:name="" android:required="false"/>
<uses-feature android:name="" android:required="false" />

are the camera specific features I use in the app.

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.

Answer Source

According to android developers permission-group:

Note that this element does not declare a permission itself, only a category in which permissions can be placed. See the element for element for information on declaring permissions and assigning them to groups

You would need two permissions Manifest.permission:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />

to be able to access the camera and the flashlight.

And you would need to declares the hardware features that is used by the application (camera and flash) Features Reference:

<uses-feature android:name="" android:required="false" />
<uses-feature android:name="" android:required="false" />

android:required indicates whether phones not having these hardware can install your application or not.

On your third point, I think you have a type because uses-permission tag can not be used with android.hardware...

<uses-permission android:name=""/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download