facebook android api发送位图、消息和链接
我需要发送一条短信,位图图像(不是url!)和一个到Facebook墙的链接。我尝试了两种方法: 第一种是使用facebook android api发送位图、消息和链接,android,facebook,facebook-graph-api,Android,Facebook,Facebook Graph Api,我需要发送一条短信,位图图像(不是url!)和一个到Facebook墙的链接。我尝试了两种方法: 第一种是使用me/feed。它允许我发送消息和链接,但不允许发送图像: postParams.putByteArray("picture", data); postParams.putString("message", "My message here"); postParams.putString("link", "http://www.google.com"); Request request
me/feed
。它允许我发送消息和链接,但不允许发送图像:
postParams.putByteArray("picture", data);
postParams.putString("message", "My message here");
postParams.putString("link", "http://www.google.com");
Request request = new Request(session, "me/feed", postParams, HttpMethod.POST, callback);
我收到一个异常:“图片url格式不正确”
第二种是使用me/photos
:
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);
在这种情况下,帖子被成功发布并出现在Facebook的墙上,但没有链接
如何发布这三件事?解决方案很简单:必须将信息和链接结合起来:
postParams.putByteArray("photo", data);
postParams.putString("message", "My message here http://www.google.com");
//postParams.putString("link", "http://www.google.com");
Request request = new Request(session, "me/photos", postParams, HttpMethod.POST, callback);