Android使用ShareOpenGraphObject共享照片和文本

时间:2015-06-02 03:27:04

标签: android facebook-graph-api facebook-opengraph facebook-sdk-4.0

我试图通过我的Android应用程序将图像和文本一起发布但是共享对话框显示禁用了帖子链接,甚至窗口在几秒钟后自动消失,错误:无法为用户生成预览...我的代码出错了? enter image description here enter image description here

SharePhoto photo1 = new SharePhoto.Builder()
                .setBitmap(bi)
                .setImageUrl(Uri.parse(recUrl))
                .build();

        ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
                .putString("og:type", "healthsynergy.photo")
                .putString("og:title", "food")
                .putString("og:description", "This is a wonderful food.")
                .putPhoto("og:image",photo1)
                .build();


        ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
                .setActionType("healthsynergy.publish_actions")
                .putObject("photo", object)
                .build();
        ShareOpenGraphContent content1 = new ShareOpenGraphContent.Builder()
                .setPreviewPropertyName("photo")
                .setAction(action)
                .build();


        shareDialog.show(content1);

1 个答案:

答案 0 :(得分:0)

即使您在共享对象中有图像,似乎也无法在未设置“图像”的情况下发布OG操作。