尝试共享图片时遇到以下问题......
我可以通过代码在我的应用程序上共享OpenGraph:
设置权限 -
LoginManager.getInstance().logInWithPublishPermissions(
thisActivity,
Arrays.asList("publish_actions"));
他们创建并分享OpenGraph -
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "fitness.course")
.putString("og:title", "Sample Course")
.putString("og:description", "This is a sample course.")
.putInt("fitness:duration:value", 100)
.putString("fitness:duration:units", "s")
.putInt("fitness:distance:value", 12)
.putString("fitness:distance:units", "km")
.putInt("fitness:speed:value", 5)
.putString("fitness:speed:units", "m/s")
.build();
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("fitness.runs")
.putObject("fitness:course", object)
.build();
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("fitness:course")
.setAction(action)
.build();
shareDialog.show(thisActivity, content);
但是当我尝试将图片附加到Open Graph时,我收到错误:
无法通过网络或已安装的内容显示提供的内容 Facebook应用程序的版本。某些对话框仅支持启动 API 14。
我用来附加图片的代码是:
首先,创建照片对象 -
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bitmapLogoPhoto)
.build();
然后创建并共享Open Graph对象(与上面代码的唯一区别是我使用.putPhoto(“image”,photo)将照片包含到ShareOpenGraphPhoto中):
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "fitness.course")
.putString("og:title", "Sample Course")
.putString("og:description", "This is a sample course.")
.putInt("fitness:duration:value", 100)
.putString("fitness:duration:units", "s")
.putInt("fitness:distance:value", 12)
.putString("fitness:distance:units", "km")
.putInt("fitness:speed:value", 5)
.putString("fitness:speed:units", "m/s")
.build();
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("fitness.runs")
.putObject("fitness:course", object)
.putPhoto("image", photo)
.build();
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("fitness:course")
.setAction(action)
.build();
shareDialog.show(thisActivity, content);
我做错了什么?
我很感激任何帮助。
提前致谢