• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

FlashLight that uses Camera Flash

Actually, I believe he meant the exact opposite conclusion. The API supports it. Its an implementation thing we have to work out, and if we shared the code it might be much easier to do. I have a feeling I'm pretty close with a barebones app, but I am still learning the syntax. Luckily, it seems to be modeled right after Java.

I'm certain I can get the app working, I just need a little guidance.
 
Upvote 0
I agree that the API supports it, but that doesn't necessarily mean the Droid hardware/drivers support it. I think the whole point of calling getSupportedFlashModes() is to identify which modes the current hardware supports.

Anyway, has anyone gotten a chance to try it on the hardware? I didn't have time last night...
 
Upvote 0
I agree that the API supports it, but that doesn't necessarily mean the Droid hardware/drivers support it. I think the whole point of calling getSupportedFlashModes() is to identify which modes the current hardware supports.

Anyway, has anyone gotten a chance to try it on the hardware? I didn't have time last night...

I am trying it right now. I can get access to the camera (I hear the 3 clicks just like when you open the camera), but can't get the flash to turn on.

This is the code I am trying...

Code:
camera = Camera.open();
 parameters = camera.getParameters();
 List<String> list = parameters.getSupportedFlashModes();
 
 if (list != null)
 {
	 /*for(int i = 0; i < list.size(); i++)
	 {
		 Toast.makeText(context, list.get(i), Toast.LENGTH_LONG).show();            		 
	 }*/
	 
	 parameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON);
	 camera.setParameters(parameters);
	 camera.startPreview();
	 Toast.makeText(context, "LED IS ON", Toast.LENGTH_SHORT).show();
 }

I just added the startPreview() to see if it helped, but it didn't.
 
Upvote 0
Upvote 0
Apparently there was a silent update to the camera app... or camera hardware drivers... over the last couple of days. Perhaps the torch flash mode has been enabled as a consequence? Bears looking into.

I was thinking the same thing. I will be trying this out in a little while. Left my USB cable at home. running home for lunch to pick it up.
 
Upvote 0
When its on Auto, it fires the flash for a few seconds in dark situations while it auto-focuses. I'm wondering if there's some way to leverage that. Is there an event that fires when auto focus is complete? is there a way to force it to keep retrying? Just some thoughts... though that would probably burn through the battery quickly while you're forcing the camera to keep retrying.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones