2

Firstly I am aware that there are a number of similar questions already asked so apologies for the repetition. I am endeavouring to share a custom Open Graph story to Facebook from an App I am developing using the Share Dialog approach. I have followed the documentation and also looked into existing questions for guidance but I cannot make this work.

What I see when I attempt to test the integration is the Share Dialog appears momentarily then it dismisses itself. I get the following (terrifically useful) message in the log "com.facebook.FacebookException: Failed to generate preview for user"! Try as I might I cannot get past this problem.

I have created a custom Story from the Facebook dashboard with an action of "Complete" and an object of "Puzzle". I have set an html file for the puzzle object on an external server. The code in the app is as follows:

final ArrayList<Bitmap> imageList = new ArrayList<Bitmap>();
imageList.add(image);

OpenGraphObject puzzle = OpenGraphObject.Factory.createForPost("puzzle");
puzzle.setProperty("title", title);
puzzle.setProperty("image", "http://www.example.com/app-facebook/images/icon.png");
puzzle.setProperty("url", "http://www.example.com/app-facebook/puzzle.html");
puzzle.setProperty("description", desc);

OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
action.setType("myapp.complete");
action.setProperty("puzzle", puzzle);

FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this, action,
    "puzzle")
//.setImageAttachmentsForObject("puzzle", imageList)
.build();
if (FacebookDialog.canPresentOpenGraphActionDialog(getApplicationContext(),
    FacebookDialog.OpenGraphActionDialogFeature.OG_ACTION_DIALOG)) {
    fbUiHelper.trackPendingDialogCall(shareDialog.present());
} else {
    Log.w(LOG_TAG, "fbShareStory: Cannot present");
}

Any help much appreciated.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
user3621075
  • 343
  • 2
  • 11
  • I would add the the naming convention seems unclear I have tried my app:complete and my app.complete without any noticeable difference. – user3621075 May 09 '14 at 16:11
  • RESOLVED - Turns out to be a Facebook permissions issue. One needs to make sure one is defined as a Developer or tester for the App in question! – user3621075 May 13 '14 at 09:24
  • Did you have a problem getting this through the submission procedure? I've gotten it to work for my dev accounts but nobody else. – Carlos Aug 25 '14 at 13:02

0 Answers0