Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>if (FacebookDialog.canPresentShareDialog(this, FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) { FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder( this) .setLink(// what ever you want to share use here .build(); uiHelper.trackPendingDialogCall(shareDialog.present()); } else { Session session = Session.getActiveSession(); if (session != null &amp;&amp; session.isOpened()) { Log.d("Tag", "Success!"); publishFeedDialog(); } else { //ask the user to login . //authButton.performClick(); share = true; // } } </code></pre> <p>So from the above code if the fb app is already installed it will open that app else you have to ask the user to login by performing Fb LoginButton . performClick(). so the user will be redirected to web dialog of fb login. the onLogin success call back u can share using.,</p> <pre><code>private void publishFeedDialog() { Bundle params = new Bundle(); params.putString("link", ""); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( MenuActivity.this, Session.getActiveSession(), params)) .setOnCompleteListener(new OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the success // and the post Id. final String postId = values.getString("post_id"); if (postId != null) { Toast.makeText(MenuActivity.this, "Posted", Toast.LENGTH_SHORT).show(); } else { // User clicked the Cancel button Toast.makeText( MenuActivity.this .getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT) .show(); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button Toast.makeText( MenuActivity.this.getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT) .show(); } else { // Generic, ex: network error Toast.makeText( MenuActivity.this.getApplicationContext(), "Error posting story", Toast.LENGTH_SHORT) .show(); } } }).build(); feedDialog.show(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload