SoFunction
Updated on 2025-04-07

An example code for Android to determine whether you have permission to take pictures

The following code introduces you to determine whether Android has permission to take pictures. The specific code is as follows:

/**
  * Return true means that it can be used Return false means that it cannot be used
  */
public boolean cameraIsCanUse() {
  boolean isCanUse = true;
  Camera mCamera = null;
  try {
    mCamera = ();
     mParameters = (); //For Meizu mobile phone    (mParameters);
  } catch (Exception e) {
    isCanUse = false;
  }
  if (mCamera != null) {
    try {
      ();
    } catch (Exception e) {
      ();
      return isCanUse;
    }
  }
  return isCanUse;
}

The above is the example code for determining whether Android has permission to take photos introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!