I\'m trying to get my mobile game to invite friends from facebook but I\'m unable to. I\'m using Facebook c# SDK for Windows 8 (hopefully porting when ready to WP8, Android
Yes it is possible. Unfortunately, you cannot do it via the SDK since Facebook doesnt allow you to send requests programatically. It has to be done through the dialog request box/popup.
So, make sure the user is logged in before trying the following solution. After you get the facebook access token by using the LoginAsync method, follow these steps.
<phone:WebBrowser Visibility="Collapsed" IsScriptEnabled="True" Name="FbBrowser"></phone:WebBrowser>
Now in your code behind, create a string with the facebook ids of the users you want to invite in CSV format like "id1,id2,id3".
Navigate the web browser to the following page and subscribe to the navigating event:
"https://m.facebook.com/dialog/apprequests?" + "message=your_message&app_id=" + "your_facebook_appid" + "&redirect_uri=https://m.facebook.com&to=" + user_facebook_ids_CSV + "&sdk=2&display=touch"
FbBrowser.Visibility = Visibility.Visible;
FbBrowser.Navigating += FbBrowser_Navigating;
FbBrowser.Navigate(url1);
private void FbBrowser_Navigating(object sender, NavigatingEventArgs e)
{
if (e.Uri.ToString().StartsWith("https://m.facebook.com/?error_code") || e.Uri.ToString().StartsWith("https://m.facebook.com/?request"))
{
FbBrowser.Visibility = Visibility.Collapsed;
FbBrowser.Navigate(new Uri("about:blank"));
}
}