0

I have a code which I use to share a screenshot on Facebook once the user clicks on my "share" UI button, (once he logged in to Facebook). It works well and it shares the image directly on Facebook, but I want to have before the standard Facebook popup window that would ask the user the approval to share (and also includes the Facebook's privacy settings -public/friends only/ private.

I can get this dialog when I use FB.ShareLink, but I need to share a screenshot so I use FB.API

Here is the code:

  public void FacebookLogin()
  {
   var permissions = new List<string>() { "publish_actions" };
   FB.LogInWithPublishPermissions(permissions);
  }
  public void FacebookShare()
  {
    var bytes = GameManager.instance.tex.EncodeToPNG();
    var wwwForm = new WWWForm();
    wwwForm.AddBinaryData("image", bytes, "InteractiveConsole.png");
    wwwForm.AddField("message", "I did a thing!  Did I do this right?");
    FB.API("me/photos",HttpMethod.POST, APICallback, wwwForm);
  }
SHAI
  • 789
  • 3
  • 10
  • 43
  • if you post with the api, you have to create your own popup for it. there is no official way. – andyrandy Mar 14 '18 at 16:50
  • When I use FB.ShareLink I get that popup window, is there another sharing method I could use to share a screenshot/texture beside FB.API that will include the facebook popup? – SHAI Mar 14 '18 at 17:14
  • again, there is no official way. you will have to create that popup on your own. – andyrandy Mar 14 '18 at 17:20
  • Create a URL on your website/somewhere, that returns the right Open Graph meta data for title, description and thumbnail - and then share that as a link ... But in that case, you need to make the image available under an HTTP(S) URL, too - you can not just directly upload the binary image data this way. – CBroe Mar 15 '18 at 08:30
  • Or create your own UI to ask the user for confirmation, and set the privacy in your API call as well. (But that would be rather tricky, because you can not specify a broader privacy than what the user has set as default privacy level for your app, but you can not query that default level either - so that might end up in a row of “trial and error” API request, unless you figured out which privacy value your app actually can set in the specific situation.) – CBroe Mar 15 '18 at 08:30

0 Answers0