Turn ON/OFF Camera LED/flash light in Samsung Galaxy Ace 2.2.1 & Galaxy Tab

I will soon released a new version of my app to support to galaxy ace. You can download here: https://play.google.com/store/apps/details?id=droid.pr.coolflashlightfree In order to solve your problem you should do this: this._camera = Camera.open(); this._camera.startPreview(); this._camera.autoFocus(new AutoFocusCallback() { public void onAutoFocus(boolean success, Camera camera) { } }); Parameters params = this._camera.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_ON); this._camera.setParameters(params); params = this._camera.getParameters(); … Read more

Can I change the LED intensity of an Android device?

HTC has an alternative API that supports this, however it’s only on HTC Sense devices, and as of Gingerbread they’ve changed the permissions so it’s only for their Flashlight app, not third party ones (unless you use root). But on 2.2 HTC devices you can use it by writing a string to /sys/devices/platform/flashlight.0/leds/flashlight/brightness. This controls … Read more

LED flashlight on Galaxy Nexus controllable by what API?

What I found out is that some devices need a SurfaceView to turn on the LED. SurfaceView preview = (SurfaceView) findViewById(R.id.PREVIEW); SurfaceHolder mHolder = preview.getHolder(); mHolder.addCallback(this); Camera mCamera = Camera.open(); mCamera.setPreviewDisplay(mHolder); // Turn on LED Parameters params = mCamera.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_TORCH); mCamera.setParameters(params); mCamera.startPreview(); … // Turn off LED Parameters params = mCamera.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_OFF); mCamera.setParameters(params); mCamera.stopPreview(); mCamera.release(); … Read more

Use camera flashlight in Android

Every device is a bit different. Samsung especially likes to make things complicated for app developers. On the Galaxy Tab you should be good with: Camera cam; void ledon() { cam = Camera.open(); Parameters params = cam.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_ON); cam.setParameters(params); cam.startPreview(); cam.autoFocus(new AutoFocusCallback() { public void onAutoFocus(boolean success, Camera camera) { } }); } void ledoff() … Read more