我需要为了使用照相机闪光灯的摄像头preVIEW什么许可? [英] What permission I need in order to use camera flash in camera preview?

查看:207
本文介绍了我需要为了使用照相机闪光灯的摄像头preVIEW什么许可?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的摄像头应用程序,我需要能够打开闪光灯(实际上toarch模式)/关闭。

I have a custom camera application and I need to be able to turn flash on(toarch mode actually)/off.

我需要什么样的权限在这种情况下?

What kind of permission do I need in this case?

1.Only

<使用特征的android:NAME =android.hardware.camera/>

<使用许可权的android:NAME =android.permission.CAMERA/>

2。
那些来自1加:

2. Those from 1 plus:

<允许机器人:名字=android.permission.FLASHLIGHT
     机器人:permissionGroup =android.permission-group.HARDWARE_CONTROLS
     安卓的ProtectionLevel =正常/>

我认为当你要使用Flash这个被使用,但没有摄像头(如在这种情况下:的 Android的 - 使用相机闪光灯

I think this is used when you want to use Flash, but without camera (like in this case: Android - Using Camera Flash)

3.Those 1加:

3.Those from 1 plus:

<使用许可权的android:NAME =android.hardware.camera.flash/>

EDITED (感谢@maclir):

EDITED (thanks to @maclir):

以上行不正确。正确的是:

Above line is incorrect. The correct one is:

<使用许可权的android:NAME =android.permission.CAMERA/>

Developer.android.com:子模块的应用程序使用设备相机的闪光灯。 ( http://developer.android.com/guide/topics/清单/使用-功能element.html

Developer.android.com: "Subfeature. The application uses the device camera's flash." (http://developer.android.com/guide/topics/manifest/uses-feature-element.html)

在所有3例,2设备的测试,工作正常 - 我可以激活/关闭闪光灯,但我想知道究竟他们每个人的手段。
这是奇怪的,即使没有选项三是工作确定...什么比使用的选项3?

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

答案

<使用许可权的android:NAME =android.permission.CAMERA/>
是为了使用相机强制性的(我没有意图通过使用相机,我有一个自定义相机应用)

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

&LT;使用特征的android:NAME =android.hardware.camera机器人:所需=FALSE/&GT;
&LT;使用特征的android:NAME =android.hardware.camera.flash机器人:所需=FALSE/&GT;

是我在应用程序中使用相机的特定功能。

are the camera specific features I use in the app.

的android:要求=假意味着谷歌Play将不可以 prevent被安装到不包括设备的应用这些摄像功能 - 有这么一个设备,而无需摄像头和相机闪光灯的用户将能够从市场安装应用程序

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

推荐答案

据Android开发者<一个href=\"http://developer.android.com/guide/topics/manifest/permission-group-element.html\">permission-group:

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

您将需要两个权限<一个href=\"http://developer.android.com/reference/android/Manifest.permission.html\">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.

和你需要声明所使用的应用程序(相机和闪光灯)<一个硬件功能href=\"http://developer.android.com/guide/topics/manifest/uses-feature-element.html#features-reference\">Features参考:

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

的android:需要表示没有这些硬件的手机是否可以安装应用程序或不

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

在你的第三点,我认为你有一个类型,因为使用许可权标签不能与 android.hardware ... <使用/ code>

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="android.hardware.camera.flash"/>

这篇关于我需要为了使用照相机闪光灯的摄像头preVIEW什么许可?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆