如何“喜欢” Facebook上的一个页面和Android应用程序? [英] How to "like" a page on Facebook from and Android Application?

查看:120
本文介绍了如何“喜欢” Facebook上的一个页面和Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友我有一个问题,如何从我的应用程序在Facebook中喜欢一个页面?我可以使用页面ID检索Facebook页面的所有信息,我也可以评论页面墙,我的要求是能够喜欢Facebook中的一个我无法做的页面。我已经经历了图形API,但无法找到解决方案。



我尝试过这个代码

  dialog = ProgressDialog.show(MyApp.this,,
please wait ..,true,true);
Bundle params = new Bundle();
mAsyncRunner.request(PAGE_ID / likes,params,POST,新的UploadListener(),null);


public class UploadListener implements RequestListener {

@Override
public void onComplete(String response,Object state){
System.out .println(THE RES IS:+ response);
dialog.dismiss();
}

一旦我运行这个代码它给错误THE RES is:

  {
error:
{
message:(#3)有能力使这个API调用。,
type:OAuthException,
code:3
}
}


解决方案

页面的Facebook文档已更新,是最新的(请参阅 https://developers.facebook.com/docs/reference/api/page/ )。即使您可以读取类似的计数信息,也不能通过Graph API来寻找页面。
没有一个API,你可以试试这个。
像在Android应用程序页面从应用程序本身


Hi friends I have an one issue, how to likes a page in Facebook from my application?? I am able to retrieve all the information of Facebook page using page id, also i am able to comment to the page wall, my requirement is that would be able to likes a page in Facebook which i am unable to do..??.I have gone through graph API but unable to find solution..??

I tried this code

dialog = ProgressDialog.show(MyApp.this, "",
                    "please wait..", true, true);
            Bundle params = new Bundle();
    mAsyncRunner.request("PAGE_ID/likes",params,"POST",new UploadListener(), null);


public class UploadListener implements RequestListener {

        @Override
        public void onComplete(String response, Object state) {
            System.out.println("THE RES IS : "+response);
            dialog.dismiss();
        }

once i run this code it gives error THE RES IS :

{
  "error": 
  {
    "message": "(#3) Application does not have the capability to make this API call.", 
    "type": "OAuthException", 
    "code": 3
  }
}

解决方案

The Facebook documentation for Pages has been updated and is current (see https://developers.facebook.com/docs/reference/api/page/). You cannot like a Page via the Graph API, even though you can read the like count information. There are not an API for it, you can try this. like android application page in facebook from application itself

这篇关于如何“喜欢” Facebook上的一个页面和Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆