Android使用Facebook的开放图谱发布图文分享
Android 平台中的开放图谱动态:https://developers.facebook.com/docs/sharing/opengraph/android
Object Types 和 Action Types:https://developers.facebook.com/docs/reference/opengraph
private void shareBargainOrder() {
// Create an object
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "article")
.putString("og:url", mBargainOrder.getInviteUrl())
.putString("og:title", mBargainGoods.getName())
.putString("og:description", mBargainGoods.getDescription())
.putString("og:image", mBargainGoods.getPicUrl())
.putString("fb:app_id", mResources.getString(R.string.facebook_app_id))
.build();
// Create an action
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("news.publishes")
//.setActionType("news.reads")
.putObject("article", object)
.build();
// Create the content
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("article")
.setAction(action)
.build();
if (ShareDialog.canShow(ShareLinkContent.class)) {
mShareDialog.show(content);
} else {
ShareApi.share(content, mFacebookCallback);
}
}
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/18/android-use-facebook-open-graph-to-publish-and-share-images-and-text/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Android使用Facebook的开放图谱发布图文分享
Android 平台中的开放图谱动态:https://developers.facebook.com/docs/sharing/opengraph/android
Object Types 和 Action Types:https://developers.facebo……
文章目录
关闭
共有 0 条评论