title: How to find the application that is using camera?
body: <p>I'm doing an Android application that discovers if an app is using the camera in background.</p>
  
  <p>Thanks to <a href="https://stackoverflow.com/a/38941855/9643103">this</a>, I can find if an app is using the Camera in your Android phone, so my code looks like this:</p>
  
  <pre><code>CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
  @Override
             public void onCameraAvailable(@NonNull String cameraId) {
                 super.onCameraAvailable(cameraId);
                 //Camera is not used
             }
  
             @Override
             public void onCameraUnavailable(@NonNull String cameraId) {
                 super.onCameraUnavailable(cameraId);
                 //Camera is used
             }
         }, new Handler());
  </code></pre>
  
  <p>But now I've found a problem: how can I find <strong>the app</strong> that is using the camera (as "app" I mean the Package Name of the app)? I've tried using 
   <code>manager.[something]</code>, wishing that the automatic hints in Android Studio could help me, without success.  </p>
  
  <p>Can you help me?</p>
  
  <p>If you need further information, just ask me.</p>
  
  <p>Thanks in advance,</p>
  
  <p>F.</p>