title: ACCESS_FINE_LOCATION permissions
body: <p>I have been trying to figure out how to properly setup the android permissions for <code>CAMERA</code> and <code>ACCESS_FINE_LOCATION</code> on API 23+.</p>
  
  <p>My program will request the <code>CAMERA</code>, but it will not request the <code>ACCESS_FINE_LOCATION</code> permission during runtime.</p>
  
  <p>I have read <a href="https://developer.android.com/training/permissions/requesting.html" rel="nofollow noreferrer">permissions</a> and <a href="https://developer.android.com/training/location/retrieve-current.html" rel="nofollow noreferrer">location</a> developers page, but I cannot seem to grasp how to request the permissions properly. I have also looked through stackoverflow for answers, but still do not understand. </p>
  
  <p>Would someone be able to explain what I am doing wrong in my code, and how to fix it?</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>    private void connectCamera() {
      CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
      try {
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) {
              if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) ==
                      PackageManager.PERMISSION_GRANTED) {
                  cameraManager.openCamera(mCameraId, mCameraDeviceStateCallback, mBackgroundHandler);
              } else {
                  if (shouldShowRequestPermissionRationale(android.Manifest.permission.CAMERA))  {
                      Toast.makeText(this,
                              "Video app required access to camera and location", Toast.LENGTH_SHORT).show();
                  }
                  requestPermissions(new String[]{android.Manifest.permission.CAMERA,
                          android.Manifest.permission.ACCESS_FINE_LOCATION,
                          Manifest.permission.ACCESS_COARSE_LOCATION
                  }, REQUEST_CAMERA_PERMISSION_RESULT);
              }
  
          } else {
              cameraManager.openCamera(mCameraId, mCameraDeviceStateCallback, mBackgroundHandler);
          }
      } catch (CameraAccessException e) {
          e.printStackTrace();
      }
  }
  
  
      @Override
  public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
      super.onRequestPermissionsResult(requestCode, permissions, grantResults);
      if (requestCode == REQUEST_CAMERA_PERMISSION_RESULT) {
          if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
              Toast.makeText(getApplicationContext(),
                      "Application will not run without camera and location services!", Toast.LENGTH_SHORT).show();
          }
      }
  }
  </code></pre>