How to turn on/off camera LED / flashlight in Android

In this tutorial, we show you how to turn on/off the phone camera led or flashlight in Android. See code snippets : 1. Turn on camera = Camera.open(); Parameters p = camera.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_TORCH); camera.setParameters(p); camera.startPreview(); 2. Turn off camera = Camera.open(); Parameters p = camera.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_OFF); camera.setParameters(p); camera.stopPreview(); And, put following permission on AndroidManifest.xml. <uses-permission … Continue reading How to turn on/off camera LED / flashlight in Android