Kel*_*ton 9 api android facebook
我想能够使用facebook android sdk并发布一个链接到Facebook.我想要的一个例子是,如果您在Facebook上并且键入了状态部分的链接,例如"http://www.google.com".当您执行此操作时,会弹出一个框,您的帖子最终会成为具有图像和链接的块.我在facebook api中找到了使用附件的文档,但是当我尝试使用android facebook api时,它似乎不起作用.我在网上看了几个小时,没有运气.谢谢.
Kel*_*ton 16
当你读到这篇文章时,你知道如何通过api登录facebook等等...
private void fbImageSubmit(Facebook fb, String imageurl, String caption, String description, String name, String linkurl)
{
if(fb != null)
{
if(fb.isSessionValid())
{
Bundle b = new Bundle();
b.putString("picture", imageurl);
b.putString("caption",caption);
b.putString("description",description );
b.putString("name",name);
b.putString("link",linkurl);
try {
String strRet = "";
strRet = fb.request("/me/feed",b,"POST");
JSONObject json;
try {
json = Util.parseJson(strRet);
if(!json.isNull("id"))
{
Log.i("Facebook", "Image link submitted.");
}
else
{
Log.e("Facebook","Error: " + strRet);
}
} catch (FacebookError e) {
Log.e("Facebook","Error: " + e.getMessage());
}
} catch (Exception e) {
Log.e("Facebook", "Error: " + e.getMessage());
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15435 次 |
| 最近记录: |