This is the code :
public void turnOnFlashLight() {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
cameraManager.setTorchMode(cameraId, true);
playOnOffSound();
powerButton.setImageResource(R.drawable.b3);
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(Flash_main.this,"onFunction",Toast.LENGTH_SHORT).show();
}
}
public void turnOffFlashLight() {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
cameraManager.setTorchMode(cameraId, false);
playOnOffSound();
powerButton.setImageResource(R.drawable.b4);
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(Flash_main.this,"offFunction",Toast.LENGTH_SHORT).show();
}
}
I am running android studio
please help, I want to make this app for android 5.0 and above but
cameraManager.setTorchMode(cameraId, true);
but this library supports Android 6.0 and above
Any Alternative Please!