Reputation: 2230
I'm using the Facebook SDK for Android and when I send a friend request using the below code, I get the following error: "Sorry, something went wrong. We're working on getting this fixed as soon as we can."
Is this a problem on my side or on Facebook's? This code was working perfectly fine a few days ago. It opens up a popup with the friend request as usual. But when I click accept, it shows me the error page. Please help me.
private void sendRequestDialog(String friendID)
{
Bundle params = new Bundle();
params.putString("id", friendID);
WebDialog friendDialog = (
new WebDialog.Builder(context, Session.getActiveSession(), "friends", params))
.setOnCompleteListener(new OnCompleteListener()
{
@Override
public void onComplete(Bundle values, FacebookException error)
{
if(error != null)
{
if(error instanceof FacebookOperationCanceledException)
{
Toast.makeText(context, "Friend Request Cancelled", Toast.LENGTH_SHORT).show();
}
else
{
//Toast.makeText(getApplication().getApplicationContext(), "Network Error", Toast.LENGTH_SHORT).show();
}
}
else
{
final String requestId = values.getString("request");
if (requestId != null)
{
Toast.makeText(context, "Friend Request Sent", Toast.LENGTH_SHORT).show();
removeFriend();
}
else
{
Toast.makeText(context, "Friend Request Cancelled", Toast.LENGTH_SHORT).show();
}
}
}
})
.build();
friendDialog.show();
}
Upvotes: 2
Views: 1554
Reputation: 1343
I was struggling with the same issue.
The workaround for me was to double-check the permissions. (first_name, last_name with name, etc arent working correctly) You should start by removing all and only take "email" and then add the remaining permissions accordingly which will make it easier to understand.
LoginManager.getInstance().logInWithReadPermissions(
this,
listOf("email") //, "name", "first_name", "public_profile"
)
Upvotes: 1
Reputation: 25994
Try change
params.putString("id", friendID);
to
params.putString("to", friendID);
Upvotes: 0