WebDialog posts a message on Facebook when a user removes an application from settings

Hi, I have a problem with Facebook:

Happening:

1. The user does not have a Facebook application.

2. Facebook user login via WebDialog

3.User provides all sharing permissions and posts

4.User logs into Facebook account than in apps, and deletes my app.

5.User is trying to make a resource again.

6. "Unknown error. Try again later." Appears in WebDialog.

Is there any way to fix this case? I found that using ShareDialog I can avoid this problem when the user has installed the facebook application, but I do not know how to solve it if the user does not have the fb application on his phone.

To show the dialogue, I confirm:

private boolean checkFacebookLogin(){ Session session = Session.getActiveSession(); if(session!=null && session.isOpened() ){ return true; } return false; } 

Then I ask for permissions if necessary:

  private void performPublish() { Session session = Session.getActiveSession(); pendingAction = PendingAction.POST_STATUS_UPDATE; if (session != null && mCurrentActivity!=null) { if (hasPublishPermission()) { // We can do the action right away. handlePendingAction(); } else { // We need to get new permissions, then complete the action when we get called back. session.requestNewPublishPermissions(new Session.NewPermissionsRequest(mCurrentActivity, PERMISSIONS)); } } } 

At the end, I show WebDialog:

  WebDialog feedDialog = ( new WebDialog.FeedDialogBuilder(mCurrentActivity, Session.getActiveSession(), postParams)) .setOnCompleteListener(new OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { } }) .build(); feedDialog.show(); 

After displaying WebDialog, it redirects to the page with the message "Unknow error [...]" the text, I did not find any error information, so I donโ€™t even know that something went wrong.

I tried HelloFacebookSample, but if the user does not have a facebook application, he cannot edit the message in the facebook dialog. I want to see the Facebook dialog in both cases (with / without the fb application installed).

+6
source share
1 answer
 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 && session.isOpened()) { Log.d("Tag", "Success!"); publishFeedDialog(); } else { //ask the user to login . //authButton.performClick(); share = true; // } } 

So, from the above code, if the fb application is already installed, it will open this application again, you should ask the user to log in using Fb LoginButton. performClick (). therefore, the user will be redirected to the fb login web dialog. successful call onLogin u can share.,

 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(); } 
+1
source

All Articles