Android.hardware.camera를 사용하지 않고도 손전등을 제어 할 수 있습니까?

StackOverflow https://stackoverflow.com/questions/6024087

문제

zxing1.6 바코드 스캐너가있는 전면 라이트 옵션의 사용은 내 Nexus One에서 작동하지 않습니다.내 앱에서 손전등을 사용할 수 있어야하지만 카메라의 두 개의 인스턴스가 실행될 수 없습니다.카메라에 액세스하지 않고 손전등을 사용하는 방법이 있습니까?또는 어떻게 든 사용중인 카메라에 액세스 할 수 있습니까?

Google IntentIntegrator.java 패치를 사용하여 바코드를 스캔 할 수 있습니다.

도움이 되었습니까?

해결책

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.

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

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top