【发布时间】:2012-11-14 16:34:12
【问题描述】:
我需要在 Facebook 墙上发布位图以及消息和 url 链接。
根据https://developers.facebook.com/docs/reference/api/user/#photos,将照片添加到Facebook相册有4个参数:
source、message、place、no_story。
但是,我建议使用这样的代码:
Bitmap bm = ...;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(CompressFormat.JPEG, 100, baos);
final byte[] data = baos.toByteArray();
Bundle postParams = new Bundle();
postParams.putByteArray("photo", data);
postParams.putString("message", "My message here");
postParams.putString("link", "http://www.google.com");
Request request = new Request(session, "me/photos", postParams, HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
...此代码运行良好,只是它没有在墙上显示链接(“http://www.google.com”)。
我有三个问题:
为什么
postParams.putByteArray("photo", data)有效?根据文档(见上文),没有photo参数。如果无法使用
link参数,SLComposeViewController如何类(http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/SLComposeViewController_Class/Reference/Reference.html ) 工作?它有- (BOOL)addURL:(NSURL *)url方法。如果可以使用
link参数,为什么不行?
【问题讨论】:
标签: android facebook facebook-graph-api post