Currently I’m developing an Android app for that I’m using the Facebook SDK. It’s working fine for posting messages to the wall etc., but through this SDK I’m unable to send an app request to others.
Can anyone help me out?
here is my code snippet:
Bundle params = new Bundle();
params.putString("message", getString(R.string.request_message));
Utility.mFacebook.dialog(Hackbook.this, "apprequests", params, new AppRequestsListener());
and AppRequestsListener:
public class AppRequestsListener extends BaseDialogListener {
@Override
public void onComplete(Bundle values) {
Toast toast = Toast.makeText(getApplicationContext(), "App request sent", Toast.LENGTH_SHORT);
toast.show();
}
@Override
public void onFacebookError(FacebookError error) {
Toast.makeText(getApplicationContext(), "Facebook Error: " + error.getMessage(), Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
Toast toast = Toast.makeText(getApplicationContext(), "App request cancelled", Toast.LENGTH_SHORT);
toast.show();
}
}
The android sdk has Dialogs which you can use, and when you open a dialog you specify which dialog you want to open.
You can see the list of available dialogs in the Dialogs documentation.
One of the dialogs is the Requests Dialog and you can open that from the android sdk as well, something like:
You can add more parameters for this dialog, use the documentation to see what it is you need.
Edit
Ok, check out this code:
I use it and it works well for me, the app request is being sent and the user receives it.
Since your code is pretty similar, it is safe to assume that the problem is with what’s different, and so you should post the code to what is different.
So, what’s in that AppRequestsListener of yours? Saying that it just shows a popup does not help me to help you.
Also, what is this *Hackbook”? is it an activity?