【问题标题】:Can't publish image from memory to Facebook using OpenGraph无法使用 OpenGraph 将图像从内存发布到 Facebook
【发布时间】:2014-12-07 00:25:58
【问题描述】:

我无法在 Open Graph 故事中发布从相机或本地存储中拍摄的图像。

这里是代码

OpenGraphObject exercise = OpenGraphObject.Factory
            .createForPost("my-app-share:exercise");
exercise.setProperty("title", "Title");
exercise.setProperty("description", "description");

OpenGraphAction action = GraphObject.Factory
        .create(OpenGraphAction.class);
action.setProperty("exercise", exercise);

List<Bitmap> images = new ArrayList<Bitmap>();

Bitmap image = decodeBitmapFromFilepath(imgPath);

images.add(image);

FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(
        getActivity(), action, "my-app-share:use", "exercise")
        .setImageAttachmentsForObject("exercise", images, true)
        .build();
ExerciseActivity.getUiHelper().trackPendingDialogCall(shareDialog.present());

问题是当我不包含时

.setImageAttachmentsForObject("exercise", images, true)

一切正常,FB 打开,故事按预期呈现。

只要我添加了上述行,我的 LogCat 中就会出现 FacebookError,没有任何解释

【问题讨论】:

    标签: java android facebook-graph-api facebook-opengraph


    【解决方案1】:

    我找到了答案。

    这不包含在 Facebook 的文档中。在 4.1.2 以上的 Android 版本中,在声明 Facebook 的内容提供者时,AndroidManifest.xml 文件中缺少一行。

    我刚刚加了

    android:exported="true"
    

    万一有人遇到同样的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-21
      • 1970-01-01
      相关资源
      最近更新 更多