繁体   English   中英

如何使用Facebook SDK 4.1.2从Android共享标题和描述到Facebook

[英]How to share Title and description from android to facebook using facebook sdk 4.1.2

我正在使用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);

        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM