Camera flash/LED

Community Forums/Monkey Talk/Camera flash/LED

steve_ancell(Posted 2014) [#1]
Is there any way to turn on the camera flash/LED on Android?.


therevills(Posted 2014) [#2]
Yes, but you'll need to extern it yourself:

On:
	camera = Camera.open();
	Parameters p = camera.getParameters();
	p.setFlashMode(Parameters.FLASH_MODE_TORCH);
	camera.setParameters(p);
	camera.startPreview();


Off:
camera = Camera.open();
	Parameters p = camera.getParameters();
	p.setFlashMode(Parameters.FLASH_MODE_OFF);
	camera.setParameters(p);
	camera.stopPreview();


And you'll need to add the permissions to the manifest:

<uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />


More info: http://stackoverflow.com/questions/6068803/how-to-turn-on-camera-flash-light-programmatically-in-android


steve_ancell(Posted 2014) [#3]
Thanks for that bit of info.

I've not learned extern yet so I guess I will need to look into how it is done in order to do more powerful stuff.

I will start googling about externs a bit later. ;-)