I am developing a game app. And I am sharing facebook custom stories in my app.I have created a self hosted object(html page).
I want to use that same self hosted object in android,ios and Facebook canvas app.
I have already done custom story sharing without using self hosted object for android app and below is my code for the same
OpenGraphObject objProperty = OpenGraphObject.Factory.createForPost("namespace:level");
objProperty.setProperty("title","Title");
objProperty.setProperty("image","http://www.example.com/jokedemo/image/wrong.jpg");
objProperty.setProperty("url", "http://www.example.com");
objProperty.setProperty("description", "Can you beat me?");
OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
action.setProperty("level", objProperty);
FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(FBActivity.this, action,"namespace:unlock", "level").build();
where unlock
is my action and level
is my object.
But I want it to do using self hosted object that I have created so that I can use same object for all platforms (Android, IOS , Web).
In documentation it is mentioned that Self-Hosted Objects are more useful for multi platform app than using Object api.
I followed this https://developers.facebook.com/docs/opengraph/using-objects/#selfhosted document but couldn't found anywhere there how to use it on Android.
My code for creating an self hosted object (html page)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta property="fb:app_id" content="*************" />
<meta property="og:type" content="namespace:level" />
<meta property="og:title" content="Title" />
<meta property="og:url" content="https://example.com/namespace/level.html" />
<meta property="og:description" content="Can you beat me?" />
<meta property="og:image" content="https://example.com/namespace/image/abc.png" />
</head>
<body>
</body>
</html>
If I want to use self hosted object in my Android what will be the changes in my working code or I have to do it in another way ?
Any suggestion will be highly appreciated, Thank you in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…