Wednesday, 4 September 2013

'Something went wrong' error is returned when trying to send a friend request from Android using a WebDialog Facebook SDK

'Something went wrong' error is returned when trying to send a friend
request from Android using a WebDialog Facebook SDK

I have implemented a WebDialog in order to send friend requests to
Facebook users on Android. Everything seems to be working - when I click
add, the dialog appears and I have the choice to confirm the add.
However, whenever I click that I get a facebook error 'Sorry, something
went wrong. We're working on getting this fixed as soon as we can.' Here
is the code for the WebDialog:
private void sendRequestDialog() {
Session session = Session.getActiveSession();
Bundle params = new Bundle();
params.putString("app_id",app_id);
params.putString("id", fbid);
params.putString("access_token", session.getAccessToken());
params.putString("redirect_uri", "fbconnect://success");
WebDialog requestsDialog = new WebDialog(this, "friends", params,
WebDialog.DEFAULT_THEME, new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
// TODO Auto-generated method stub
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(MainActivity.this,
"Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this,
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Toast.makeText(MainActivity.this,
"Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this,
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
});
requestsDialog.show();
}
Is there something wrong with the code or Facebook (server-side)?

No comments:

Post a Comment