title: imeediately requesting publish permissions on facebook session with android sdk
body: <p>I am trying to immediately request publish permissions on a just created user session and getting the following error because the session state is "CREATED" and not "OPENED"</p>
  
  <pre><code>"Session: an attempt was made to request new permissions for a session that is not currently open."
  </code></pre>
  
  <p>How can I immediately ask for publish permissions?  Is there any way I can authorize the new user and get the publish permissions in one single call?</p>
  
  <p>final Session session = Session.getActiveSession();
  if (session.isOpened())
  {
      shareToFacebook(loadedImage, shareBody, session);
  }
  else
  {</p>
  
  <pre><code>final StatusCallback callback = new StatusCallback() {
      public void call(Session thisSession, SessionState state, Exception exception) {
          if (exception != null) {
              Toast.makeText(getApplicationContext(), "Facebook permissions failed: " + exception.getMessage(),
                      Toast.LENGTH_SHORT).show();
          }
          else
          {
              shareToFacebook(loadedImage, shareBody, thisSession);
          }
      }
  };
  
  
  //up the permissions and then post
  if (session != null &amp;&amp; !isSubsetOf(PERMISSIONS,  session.getPermissions())) {
  
      Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(ActivityFacts.this, PERMISSIONS);
      session.addCallback(callback);
      session.requestNewPublishPermissions(newPermissionsRequest);
  }
  else
  {
      //add user then up the permissions
      StatusCallback authorizeCallback = new StatusCallback() {
          public void call(Session thisSession, SessionState state, Exception exception) {
              if (exception != null) {
                  Toast.makeText(getApplicationContext(), "Facebook login failed: " + exception.getMessage(),
                          Toast.LENGTH_SHORT).show();
              }
              else
              {
                  Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(ActivityFacts.this, PERMISSIONS);
                  session.addCallback(callback);
                  session.requestNewPublishPermissions(newPermissionsRequest);
  
              }
          }
      };
  
  
      OpenRequest openRequest = new OpenRequest(ActivityFacts.this);
      List&lt;String&gt; readPermissions = new ArrayList&lt;String&gt;();
      readPermissions.add("email");
      openRequest.setPermissions(readPermissions);
      openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK);
      openRequest.setCallback(authorizeCallback);
      session.openForRead(openRequest);
  }
  </code></pre>
  
  <p>}</p>