1

I can turn on the flash light by the codes below:

cameraId = mCamManager.getCameraIdList()[0];
mCamManager.setTorchMode(cameraId, true);

But How could I tell if it's already open. Say if users open the torch by the default Android torch in the notification toolbars, I cannot just set a default flag owned by myself.

Firouziam
  • 777
  • 1
  • 9
  • 31
user3162215
  • 357
  • 1
  • 9
  • Attempting to open a connection to the camera will fail if another app is already using the torch, as only one app can bind to the hardware at a time. – Matt Clark Jul 03 '18 at 03:36
  • pls check this one https://stackoverflow.com/questions/6068803/how-to-turn-on-front-flash-light-programmatically-in-android – Anjani Mittal Jul 03 '18 at 03:47
  • Possible duplicate of [Android how to know if flashlight is on](https://stackoverflow.com/questions/38827344/android-how-to-know-if-flashlight-is-on) – Amir Dora. Jul 03 '18 at 06:20

0 Answers0