title: Facebook Sharing is not happening?
body: <p>I am developing one app, in which I am doing facebook sharing. I am successfully able to share , but only when I didn't install the facebook app. As I am installing the facebook app, and trying to share then it is asking for login and as I am logging then I am getting following Dialog box "My app would like to access your public profile and friend list". As I am clicking on "OK" button it is doing some process and again coming on my app, but nothing is to be shared.
  Please help me.
  Here is my code:-</p>
  
  <pre><code>  public class BaseFbTwitterShareAppActivity extends Activity {
  private UiLifecycleHelper uiHelper;
  public Session.StatusCallback statusCallback = new SessionStatusCallback();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      uiHelper = new UiLifecycleHelper(this, statusCallback);
      uiHelper.onCreate(savedInstanceState);
  }
  
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      uiHelper.onActivityResult(requestCode, resultCode, data,
              new FacebookDialog.Callback() {
                  @Override
                  public void onError(FacebookDialog.PendingCall pendingCall,
                          Exception error, Bundle data) {
                  }
  
                  @Override
                  public void onComplete(
                          FacebookDialog.PendingCall pendingCall, Bundle data) {
                      // Log.i("Activity", "Success!");
                  }
              });
  }
  
  @Override
  protected void onResume() {
      super.onResume();
      uiHelper.onResume();
  }
  @Override
  protected void onSaveInstanceState(Bundle outState) {
      super.onSaveInstanceState(outState);
      uiHelper.onSaveInstanceState(outState);
  }
  @Override
  public void onPause() {
      super.onPause();
      uiHelper.onPause();
  }
  
  @Override
  public void onDestroy() {
      super.onDestroy();
      uiHelper.onDestroy();
  }
  private void shareApp() {
      Bundle params = new Bundle();
      params.putString("name", "aaa");
      params.putString("caption",
              "bbb");
      params.putString("description", "Dummy data.");
      params.putString("link", "https://www.facebook.com/xxx");
      params.putString("picture",
              "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/yyy.png");
  
      WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(this,
              Session.getActiveSession(), params)).setOnCompleteListener(
              new OnCompleteListener() {
  
                  @Override
                  public void onComplete(Bundle values,
                          FacebookException error) {
                      if (error == null) {    
                          // and the post Id.
                          final String postId = values.getString("post_id");
                          if (postId != null) {
                              Toast.makeText(BaseFbTwitterShareAppActivity.this,                                      "Posted story, id: " + postId,                                  Toast.LENGTH_SHORT).show();
                          } else {
                              // User clicked the Cancel button
                              Toast.makeText(BaseFbTwitterShareAppActivity.this,
                                      "Publish cancelled", Toast.LENGTH_SHORT)
                                      .show();
                          }
                      } else if (error instanceof FacebookOperationCanceledException) {
                          // User clicked the "x" button
                          Toast.makeText(BaseFbTwitterShareAppActivity.this,
                                  "Publish cancelled", Toast.LENGTH_SHORT)
                                  .show();
                      } else {
                          // Generic, ex: network error
                          Toast.makeText(BaseFbTwitterShareAppActivity.this,
                                  "Error posting story", Toast.LENGTH_SHORT)
                                  .show();
                      }
                  }
  
              }).build();
      feedDialog.show();
  }
  
  
  
  
  private void onSessionStateChange(Session session, SessionState state,
          Exception exception) {
      if (state.isOpened()) {
          shareApp();
      } else if (state.isClosed()) {
      }
  }
  private class SessionStatusCallback implements Session.StatusCallback {
      @Override
      public void call(Session session, SessionState state,
              Exception exception) {
          // Respond to session state changes, ex: updating the view
          // shareApp();
          try {
              // Log.d("FB", "Access token = " + session.getAccessToken());
          } catch (Exception ex) {
              ex.printStackTrace();
          }
          onSessionStateChange(session, state, exception);
      }
  }
  
  
  public void onFbButtonClick() {
      Session mSession = Session.getActiveSession();
      if (mSession == null) {
          mSession = new Session(this);
      }
  
      if (!mSession.isOpened() &amp;&amp; !mSession.isClosed()) {
          mSession.openForPublish(new Session.OpenRequest(this)
                  .setPermissions(Arrays.asList("publish_actions"))
                  .setCallback(statusCallback));
  
      } else {
          Session.openActiveSession(this, true, statusCallback);
      }
      }
      }
  </code></pre>