gpt4 book ai didi

android - 如何使用 facebook sdk 4.1.2 从 android 到 facebook 分享标题和描述

转载 作者:行者123 更新时间:2023-11-30 02:07:25 25 4
gpt4 key购买 nike

我正在使用 Facebook sdk 4.1.2 将内容分享到 Facebook。 https://developers.facebook.com/docs/sharing/android这是我为完成此任务而推荐的链接,并成功地在 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);

我已经使用上面的代码在 facebook 中发布了一个链接内容并且它工作成功。但是我没有找到任何代码来发布标题和描述而没有任何链接内容或图像。任何人都可以帮助知道我如何使用 Facebook sdk 4.1.2 本身做到这一点。

最佳答案

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);

}

关于android - 如何使用 facebook sdk 4.1.2 从 android 到 facebook 分享标题和描述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30481514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com