我正在尝试使用 Facebook sdk 通过我的 android 应用在 Facebook 上发布图像/文本。是否可以以编程方式用我的帖子标记我的 Facebook 页面?
这是我的代码:
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bitmap)
.setCaption(shareText)
.setUserGenerated(false)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
ShareApi.share(content, new FacebookCallback<Sharer.Result>() {
}
我也尝试过开放图。什么都没有发生,甚至没有显示在 facebook 上发布的对话框。这是代码:
List<String> peopleIds = new ArrayList<String>(1);
peopleIds.add("AaJa_TfLYQJXLuTCQyNBG3dHoK7WCtpXePE1_qBFVPcNB68_KyGTRTXxjKWg6L1qbStB75WSEZ8OAmRxjbA");
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bitmapWaterMark)
.setCaption(shareText)
.setUserGenerated(true)
.build();
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "aaa")
.putString("og:title", "bbb")
.putString("og:description", "ccc")
.putString("books:isbn", "ddd")
.build();
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.putObject("book", object)
.putPhoto("image", photo)
.build();
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("book")
.setAction(action)
.setPeopleIds(peopleIds)
.build();
ShareDialog.show(UploadFunnyContentActivity.this, content);