title: Ask Multiple Permissions Android
body: <p>I'm modifying an existing Face Tracker app Android's Facial Recognition sample projects. I'm having an issue with requesting multiple permanent permissions. The method below is a modified version of the existing method that successfully creates a pop up window to ask for camera permissions. I'm trying to replicate this with the storage permissions but so far I've been unsuccessful and I'm not sure what needs to be changed here.</p>
  
  <pre><code> private void requestAllPermissions() {
      Log.w(TAG, "Camera + Storage permissions are not granted. Requesting permissions");
  
      final String[] permissions = new String[]{Manifest.permission.CAMERA};
      final String[] permissions2 = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
  
  
      if (!ActivityCompat.shouldShowRequestPermissionRationale(this,
              Manifest.permission.CAMERA)) {
          ActivityCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);
          return;
      }
  
      //new
      if (!ActivityCompat.shouldShowRequestPermissionRationale(this,
              Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
          ActivityCompat.requestPermissions(this, permissions2, RC_HANDLE_STORAGE_PERM);
          return;
      }
  
  
      final Activity thisActivity = this;
  
      View.OnClickListener listener = new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              ActivityCompat.requestPermissions(thisActivity, permissions,
                      RC_HANDLE_CAMERA_PERM);
          }
      };
  
      View.OnClickListener listener2 = new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              ActivityCompat.requestPermissions(thisActivity, permissions2,
                      RC_HANDLE_STORAGE_PERM);
          }
      };
  
      Snackbar.make(mGraphicOverlay, R.string.permission_camera_rationale,
              Snackbar.LENGTH_INDEFINITE)
              .setAction(R.string.ok, listener)
              .show();
  
      Snackbar.make(mGraphicOverlay, R.string.permission_storage_rationale,
              Snackbar.LENGTH_INDEFINITE)
              .setAction(R.string.ok, listener2)
              .show();
  }
  </code></pre>