How Can I create custom og type and .setActionType() while sharing to facebook?

233 views Asked by At

I have a following code which shares content to FB. How can I create custom og.type and .setActionType.

ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
        .putString("og:type", "Tor")
        .putString("og:title", tour.getTitle())
        .putString("og:description", tour.getDescription())
        .build();

// Create an action
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
        .setActionType("tour.post")
        .putObject("Tour", object)
        .build();

// Create the content
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
        .setPreviewPropertyName("Tour")
        .setAction(action)
        .build();

ShareDialog.show(TourActivity.this, content);

Example: If I add it with "og.type" value to "books.book" and .setActionType value to books.read then it shows in FB shared content that "Is reading book".(I do not want to display anything else except content I added. It should only display TourName and Description and heading Tour:).

1

There are 1 answers

0
Mitze Meyer On

It seems like that feature has been deprecated in 2017:

https://developers.facebook.com/docs/sharing/opengraph/custom-open-graph-deprecation

There are two options to replace Custom Open Graph stories:

  1. Use built-in Open Graph actions, including the new games.plays, which posts only to people's activity log, and books.rates.
  2. Or use standard link, quote, photo, video, or multi-media share.