Skip to content Skip to sidebar Skip to footer

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? 1.Only

Solution 1:

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 <permission> element for information on declaring permissions and assigning them to groups

You would need two permissions Manifest.permission:

<uses-permissionandroid:name="android.permission.CAMERA" /><uses-permissionandroid: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-featureandroid:name="android.hardware.camera"android:required="false" /><uses-featureandroid:name="android.hardware.camera.flash"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-permissionandroid:name="android.hardware.camera.flash"/>

Solution 2:

Maclir answer is showing all the detail of permission required to use camera and its flash light. you can also use these two permission to use flashlight in your application.

<uses-permissionandroid:name="android.permission.CAMERA"/><uses-featureandroid:name="android.hardware.camera" />

Post a Comment for "What Permission I Need In Order To Use Camera Flash In Camera Preview?"