I am using Facebook sdk 4.1.2 to share contents to Facebook . https://developers.facebook.com/docs/sharing/android This is the link i reffered for doing this task And was successfull in sharing a link content in facebook.
shareDialog = new ShareDialog(ShareActivity.this);
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("Hello Facebook")
.setContentDescription(
"The 'Hello Facebook' sample showcases simple Facebook integration")
.setContentUrl(Uri.parse("http://ramees.com/Uploads/VideoGallery/17_VG/1_Video_Gallery.mp4"))
.build();
shareDialog.show(linkContent);
I have used the above code to post a link content in facebook and it is working successfully.But i didn't find any code to post title and description only without any link content or image. Can anyone help to know how can i do this with Facebook sdk 4.1.2 itself.
shareDialog = new ShareDialog(ShareActivity.this);
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "books.book")
.putString("og:title", "A Game of Thrones")
.putString("og:description","In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.")
.putString("books:isbn", "0-553-57340-3").build();
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("books.reads").putObject("book", object)
.build();
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("book")
.setAction(action)
.build();
shareDialog.show(content);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.