在我的Android相机应用中,我想将用户拍摄的照片分享给用户的脸谱墙。我希望它有:
这是我想要的图片:(推特到Facebook的帖子与此非常相似,所以我认为可以做到!)
如何实现这一点?
我应该使用Open Graph吗?
我试过跟开developers.facebook教程,但我失败了!!我觉得样品都是马车!这非常令人沮丧...
请帮忙,我需要有人给我指路!
修改
实际上这是我的代码,没有显示foto:
private void shareWithFacebookOpenGraph(String pathToImage) {
Log.i("SHARE", "1. share with OpenGraph");
OpenGraphObject photo = OpenGraphObject.Factory.createForPost("myapp:photo");
photo.setProperty("title", "MyApp Photo");
photo.setProperty("image", "http://play.google.com/to_my_app_launcher_icon");
photo.setProperty("url", "http://play.google.com/to_my_app");
photo.setProperty("description", "Image taken with myApp for Android");
List<File> files = new ArrayList<File>();
files.add(new File(pathToImage));
OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
action.setProperty("photo", photo);
FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this, action, "myapp:take", "photo")
//.setImageAttachmentFilesForObject("image", files, true) // Error: image is not a property
//.setImageAttachmentFilesForAction(files, true) // Error sharing pictue: null
//.setImageAttachmentFilesForObject("photo", files, true) // can't create Collection (?!?!)
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
}