简体   繁体   中英

WebDialog.RequestsDialogBuilder does not actually send a request?

I am working on an app, which sends a request to the selected user. Am selecting the user through FriendPickerFragment(Android.Support.V4.App). I am successfully getting the list of friends I have selected on the "Done" button of the Picker fragment. Post that, I am trying to build a request dialog, which should not show up in my app, but should send the FB request to the selected friends. Here is my code:

Bundle bundle = new Bundle ();
bundle.PutString ("app_id", AppID);
var dialog = new WebDialog.RequestsDialogBuilder (this.Activity, Session.ActiveSession,     bundle).SetMessage(user + " has invited you to join my application");
dialog.Build ();

The problem I am facing is that, the request is not actually sent. There is no exception either. I even implemented the call back:

public void OnComplete(Bundle bundle, FacebookException e)

but the execution does NOT go in the callback. What am I missing here ? Any help would be greatly appreciated.

Tried dialog.SetTo(userId) before build also....still not working... Any suggestions ?

Well, according to the documentation for RequestDialogBuilder the method public WebDialog build() , the behavior you describe is by design. Quote:

"The dialog is not shown, but is ready to be shown by calling Dialog.show()"

It sounds like you do not want to show a dialog, but just want to send a request without any UI. You are using the wrong tool to do that. To send a request using a dialog, you have to show the dialog, and the user action is what causes a request to be sent. This doesn't require any special permission to be granted ahead of time, because it only sends a request if the user chooses to after your app opens the dialog.

There may or may not be a way to do what you want (send an app request without any user interaction) ... if there is a way, it will be along these lines:

use the Graph API, get a token with some permission that the user grants to your app. Here's a place to start looking:

https://developers.facebook.com/docs/graph-api/reference/v2.1/user/apprequests/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM