我可以控制闪光灯,而无需使用android.hardware.Camera? [英] Can I control the flashlight without using android.hardware.Camera?

查看:372
本文介绍了我可以控制闪光灯,而无需使用android.hardware.Camera?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

zxing1.6 吧code扫描仪使用前灯选项并不在我的Nexus One的工作。我需要能够使用手电筒在我的应用程序,但你不能有摄像头运行的两个实例。有没有一种方法来使用手电筒,而无需访问摄像机?或者,我可以以某种方式访问​​一个摄像头,已经在使用?

The use of front light option with zxing1.6 barcode scanner does not work on my Nexus One. I need to be able to use the flashlight in my app, but you can't have two instances of the camera running. Is there a way to use the flashlight without accessing the camera? Or can I somehow access a camera that is already in use?

我使用谷歌 IntentIntegrator.java 补丁能够扫描吧codeS。

I am using the Google IntentIntegrator.java patch to be able to scan barcodes.

推荐答案

简短的回答是不;前部LED被控制为闪光模式,这是照相机的属性。这是模式的火炬。而且没有两个应用程序不能在同一时间打开摄像头。

The short answer is "no"; the front LED is controlled as a flash mode, which is a property of the camera. It is mode "torch". And no two apps can't open the camera at the same time.

(较长的回答是,这里曾经是这个隐藏API,这是什么吧code扫描程序试图访问,但它不工作在几乎任何设备上了。你可以挖掘到源code,看看 FlashlightManager

(A longer answer is that there used to be a hidden API for this, which is what Barcode Scanner tries to access, but it doesn't work on almost any device anymore. You can dig into the source code to see FlashlightManager.)

由于Android 2.X存在对开灯这个合适的API,以及对​​吧code扫描仪的下一个版本的测试版并使用它。您可以尝试在这里

Since Android 2.x there is this proper API for turning on the light, and the beta of the next version of Barcode Scanner does use it. You can try it here.

这篇关于我可以控制闪光灯,而无需使用android.hardware.Camera?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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