Android facebook API添加照片
我需要在Facebook墙上贴一张位图,并附上一条消息和url链接 根据,有4个参数可将照片添加到Facebook相册:Android facebook API添加照片,android,facebook,facebook-graph-api,post,Android,Facebook,Facebook Graph Api,Post,我需要在Facebook墙上贴一张位图,并附上一条消息和url链接 根据,有4个参数可将照片添加到Facebook相册: 来源,消息,地点,无故事 但是,有人建议我使用如下代码: Bitmap bm = ...; ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(CompressFormat.JPEG, 100, baos); final byte[] data = baos.toByteArray();
来源
,消息
,地点
,无故事
但是,有人建议我使用如下代码:
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
参数link
参数,SLComposeViewController类将如何使用(http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/SLComposeViewController_Class/Reference/Reference.html)工作?它有-(BOOL)addURL:(NSURL*)url
方法link
参数,为什么不起作用好的,我找到了问题(2)和(3)的答案。它似乎非常简单:不要使用
链接
,只需将其附加到消息
:
postParams.putByteArray("photo", data);
postParams.putString("message", "My message here" + " " + "http://www.google.com");
//postParams.putString("link", "http://www.google.com");
至于我的问题(1),我仍然不清楚:为什么postParams.putByteArray(“照片”,数据)代码>工作正常,而不是postParams.putByteArray(“源”,数据)代码>?文档中没有提到photo
参数