0
votes

Problem Description

I am writing a simple Widget for Android Devices. When user press on the widget a Camera Flashlight must turn Off and On. My Widget works fine when I launch it on Sony Ericsson Arc, but when I try to launch Widget on Samsung NexusS or Samsung Galaxy SII it do nothing (doesn't work).


Researches

I google this issue and find some answers for it. Most of users suggest to use SurfaceView and really surface view with size 1 pixel really work if it is placed on activity, but it doesn't work in my case (Widget doesn't support SurfaceViw).

LED flashlight on Galaxy Nexus controllable by what API?

I found this article and it was very useful, but how can I use it in my case, in the case if I want turn on light from widget ? I know that I can't use Surface view in Widget View as it is not supported yet, any Ideas ?


Question

Please provide me some links, open source projects or articles or something that can be helpful on how I can turn light on/off from the widget on Nexus S One and Galaxy S II.

Is there any universal code for working with camera on different phones ? Any information will be helpful.

Maybe I need to use native library ?

Thanks.

2

2 Answers

1
votes

There is no official android API allowing you to manipulate camera flash alone. You have to go via official camera API - and it does not formally define how to manipulate flash LED. YOu can set different modes, but camera software can ignore it at will.

So, if this works on sony it does not have to vork for other hardware. There could be (and most probably there are) some vendor specific undocumented APIs though.

0
votes

A bit late in response,however, the camera has to pass a surface on some devices in order to turn flash on. Given that surface view is not applicable, you need to implement a surface texture instead, available as of api 11