Facebook Open Graph - standard og.likes action with custom object type

I am trying to create a basic demo on Android that uses the Native Share dialog from the SDK / Facebook app. However, when I try to create a story with the "og.likes" action and use my custom object, it is created by Facebook as the base object type instead of the custom type I defined. So instead of saying "Johnny loves the git repository" as he should, he says, "Johnny likes the object."

Here is the code I'm using:

public void shareOpenGraphStory(Intent intent) {
    OpenGraphObject obj = OpenGraphObject.Factory.createForPost("qtino-sharing:git_repo");
    obj.setTitle("Testing OpenGraph Share");
    Log.w("FBShareActivity", "Object type is " + obj.getType());

    OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
    action.setProperty("object", obj);

    FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(mainActivity, action, "og.likes", "object")


I'm pretty sure I have correctly defined my custom object type in the Facebook Dev Center, as I can successfully share open graph stories using this type, with a custom action that I also defined.

The type of this object is set correctly, as confirmed by the log statement that is being printed, and the open graph history messages are error free (I can see this on my facebook wall). However, in Object Browser, type og: object shows "object" instead of "git_repo", and after hours of documentation and cleanup. I still can't figure out why.

Can anyone see something I am doing wrong? Or do you know if it is possible to use derived object types with action type "og.likes" when shared in a native share dialog.


source to share

1 answer

I had the same problem and couldn't fix it with the generic "og.likes" action. As a result, I created a custom action ("Suggest" in my case), added an object type ("Product" in my case) and added that type as a property of my custom action.

I was then able to create a new story ("Suggest a Product") and publish that story to my feed with the correct title (Product Name).

This is a bit more work, especially since I need to find a good action name that replaces "og.likes", but I still find it more appropriate, after which it says "liked the object".


OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);

action.setProperty("<my_custom_action_property_name>", obj);




All Articles