Skip to content

Instantly share code, notes, and snippets.

@Shebella
Last active August 29, 2015 14:06
Show Gist options
  • Save Shebella/2995e1c1b2d62d9ec701 to your computer and use it in GitHub Desktop.
Save Shebella/2995e1c1b2d62d9ec701 to your computer and use it in GitHub Desktop.
Bundle params = new Bundle();
params.putString("message", "YOUR_MESSAGE_HERE");
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(getActivity(),
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(getActivity().getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity().getApplicationContext(),
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Toast.makeText(getActivity().getApplicationContext(),
"Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity().getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
})
.build();
requestsDialog.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment