0

I am getting the following error when trying to post an Open Graph story.

Error{FacebookServiceException: httpResponseCode: -1, facebookErrorCode: 1611072, facebookErrorType: null, message: Action
 Requires At Least One Reference: The action you're trying to publish
 is invalid because it does not specify any reference objects. At least
 one of the following properties must be specified: victory.

I did not find anything about this property victory in the documentation.

The code I am using to post the story:

ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
                .putString("og:type", "games")
                .putString("og:title", "<Title>")
                .putString("og:url","<website>")
                .putString("og:image","<image link>")
                .putString("og:description", "Teste")
                .build();

        ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
                .setActionType("games.celebrate")
                .putObject("games", object)
                .build();

        ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
                .setPreviewPropertyName("games")
                .setAction(action)
                .build();

        ShareDialog.show(thisActivity, content);

How can I make it work?

Siqueira
  • 423
  • 1
  • 7
  • 29
  • Can you share me other code regarding facebook sharing ? – Sachin Suthar Jan 10 '18 at 10:23
  • The code above, and this one: https://stackoverflow.com/questions/47912271/faceboook-android-sdk-error-publish-actions-being-required-to-post-a-share-dial Is all I have done up to now. – Siqueira Jan 22 '18 at 22:48

1 Answers1

2

According to https://developers.facebook.com/docs/reference/opengraph/action-type/games.celebrate/ you have write your code block as below. try that instead you use, have something changes like "og:type", "games.victory" and .putObject("games:victory", object) . so make changes in code.

ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
    .putString("og:type", "games.victory")
    .putString("og:title", "QoF")
    .putString("og:url","https://appsonfire33.wixsite.com/website")
    .putString("og:image:url","https://static.wixstatic.com/media/792c0f_ee1843bfce26447ab34eead294163182~mv2.png/v1/fill/w_80,h_80,al_c,usm_0.66_1.00_0.01/792c0f_ee1843bfce26447ab34eead294163182~mv2.png")
    .putString("og:description", "Teste")
    .build();

ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
    .setActionType("games.celebrate")
    .putObject("games:victory", object)
    .build();

ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
    .setPreviewPropertyName("games:victory")
    .setAction(action)
    .build();

ShareDialog.show(thisActivity, content);

Hope this Help.

Dharmishtha
  • 1,313
  • 10
  • 21