Q:

Front Flash light in Android

I am developing an app where I want when a user presses a button front flashlight is on.  I know how to open a back camera flash light. 
But I don't know how to open the front camera flashlight within the same application.  Anyone will guide me how to do this? 

A:

I don't think there is such thing as "Front Flash Light".  The only thing I can think of at this stage is the Notification LED light at the front.  Even looking at my Samsung S6 Edge device, I cannot find any front flash light on my camera. 
The following code only applies to the rear flash light.  I believe there are three things you will need to do. 
1 - Check to see if there is availability for flash on the device 
2 - Set the corresponding permission in your manifest 
3 - Implement the code to operate the flash functions 
This code will return a boolean based on the availability for flash feature
context.getPackageManager().hasSystemFeature(PackageManager. FEATURE_CAMERA_FLASH);

Next are your permissions in the manifest file
<uses-permission android:name="android.permission. CAMERA" />
<uses-permission android:name="android.permission. FLASHLIGHT" /> 

The first permission is for the camera, second permission is for the flashlight where you don't have to activate the camera hardware
And finally, the code to turn on the flash
Camera myCamera = Camera.open();     
Parameters myParameters = myCamera .getParameters();
myParameters.setFlashMode(Parameters. FLASH_MODE_TORCH);
myCamera.setParameters(p);
myCamera.startPreview();

To turn the service off
myCamera.stopPreview();
myCamera.release();

Additional function to test
  CameraManager cameraManager = (CameraManager) getSystemService(Context. CAMERA_SERVICE);

  try {
    String cameraId = cameraManager.getCameraIdList()[0];
    cameraManager.setTorchMode(cameraId, true);
    flashLightStatus = true;
    imageFlashlight.setImageResource(R.drawable.btn_switch_on);
  } catch (CameraAccessException e) {
  }

This may assist in getting the front camera accessibility from getCameraIdList function.  Usually, the front camera is at the first position.