如何在Android中获取Facebook朋友的生日,电子邮件和个人资料图片
作者:互联网
如何使用Facebook SDK在Android中检索我的Facebook朋友的姓名,生日和个人资料图片,电子邮件地址?
使用Graph API或Returned JSON Object的任何方式..在这件事上帮助我..
我知道您认为这个问题已经被问到…但是逼我,您无法从任何地方获得完全的满意…
但是我在Facebook sdk文档中搜索了几乎所有问题以及所有相关链接,但是我没有任何线索可以使我走向成功…
我已经尝试获取JSON对象以及使用Graph API.
我知道使用这两种方式我们都可以获得诸如生日和朋友的个人资料之类的信息…
它不允许我在这里上传代码..但是我认为我的问题与从Facebook获得许可有关.
尝试解决这个问题,并给我一些生日,个人资料图片,电子邮件等代码段.
我困在哪里…
权限未授予,请参见下面的Logcat …
06-28 10:03:43.542: W/com.facebook.Session(3650): Should not pass a read permission (user_likes) to a request for publish or manage authorization
06-28 10:03:43.542: W/com.facebook.Session(3650): Should not pass a read permission (email) to a request for publish or manage authorization
06-28 10:03:43.542: W/com.facebook.Session(3650): Should not pass a read permission (user_birthday) to a request for publish or manage authorization
06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (link) to a request for publish or manage authorization
06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_birthday) to a request for publish or manage authorization
06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_photos) to a request for publish or manage authorization
06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_about_me) to a request for publish or manage authorization
06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_link) to a request for publish or manage authorization
它将帮助您解决我的问题.
您的所有建议都是“欢迎”.
我最近几天正在寻找解决方案,请给我一些有用的想法.
解决方法:
我将解决方案放在下面可能对其他人有帮助
使用您的权限授权Facebook
facebook.authorize(context, new String[] { "publish_stream",
"friends_birthday" }, Facebook.FORCE_DIALOG_AUTH,
new DialogListener() }
之后,在onComplete方法中获取并存储访问令牌
现在在AsyncRunner中运行此FQL,您将获得Json的响应
String query = "SELECT uid,name,username,birthday_date,pic_big FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ";
// String query = "SELECT name FROM user WHERE uid = me()";
Bundle params = new Bundle();
params.putString("method", "fql.query");
params.putString("query", query);
mAsyncRunner.request(params, new RequestListener()}
现在解析它json并在您的应用中使用.
If still you have any problem feel free to ask.
标签:facebook,facebook-android-sdk,android,facebook-graph-api 来源: https://codeday.me/bug/20191123/2065048.html