Facebook Android API 发送位图、消息和链接



我需要发送一条短信,位图图像(不是url!)和一个指向Facebook墙的链接。我尝试了两种方法:

首先是使用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);

我收到一个异常:"图片网址格式不正确"。

二是使用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墙上,但没有link

我如何发布这三件事?

解决方案很简单:必须将消息和链接统一起来:

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);

最新更新