Android版的Facebook API:如何获得有关user`s朋友扩展信息? [英] Facebook API for Android: how to get extended info regarding user`s friends?

查看:116
本文介绍了Android版的Facebook API:如何获得有关user`s朋友扩展信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的努力小型Android应用程序,尝试添加Facebook的支持。

I`m working on small Android application, trying to add Facebook support.

主要问题:我能得到的只有关于user`s朋友(ID,名称)的基本信息。 对应用程序的权限列表(offline_access在这里只是为了测试,很快就会消失):

Main problem: I can get only basic info regarding user`s friends (id, name). List of app permissions (offline_access is here just for test, will be removed soon):

 String[] sPermissions = { "friends_about_me"
                         , "friends_birthday"
                         , "friends_location"
                         , "friends_website"
                         , "offline_access" };
 mLoginButton.init(this, mFacebook,  sPermissions);

下面的请求工作正常 - 返回的ID列表:名字对,

Following request works fine - returns a list of id:name pairs,

 mAsyncRunner.request("me/friends", new SampleRequestListener());

但如果我为了得到更多信息更改

but if I change it in order to get more info

 mAsyncRunner.request("me/friends?fields=id,name,birthday,hometown", new SampleRequestListener());

服务器返回错误活跃的访问令牌必须被用于查询当前用户的信息。 我使用的浏览器进行测试,这些图形API的请求 - 他们都按预期工作

server returns error "An active access token must be used to query information about the current user." I tested these Graph API requests using browser - both of them work as expected.

小备注:使用默认的调试cetificate签署apllication并根据Facebook的指令添加哈希Facebook应用程序哈希我真的:

Small remark: I`m using default debug cetificate to sign apllication and add it hash as facebook application hash according to Facebook instruction:

注册您的应用程序的Andr​​oid密钥散列。这是用来被Facebook以确保交谈时,Facebook的Andr​​oid应用程序另一个应用程序无法模拟你的应用程序。

Register your application's Android key hash. This is used by Facebook to ensure that another app can't impersonate your app when talking to the Facebook Android app.

生成密钥散列:

密钥工具-exportcert -alias [别名]   -keystore [密钥库] | OpenSSL的SHA1 -binary | OpenSSL的BASE64在Facebook的开发者设置,请访问   移动和设备标签。

keytool -exportcert -alias [alias] -keystore [keystore] | openssl sha1 -binary | openssl base64 In the Facebook developer settings, go to the Mobile and Devices tab.

在Android中,输入密钥   哈希的密钥散列场。

In the Android section, enter the key hash in the Key Hash field.

也许有另一种方式来获得user`s frineds信息(BDAY,地点,性别等)?

Maybe there is another way to get user`s frineds info (bday, location, gender and so on)?

推荐答案

使用

mFacebook.request(graphpath,包);

方法, 捆绑将有哪些会是这样的参数

method, Bundle will have parameters which will be like this

graphpath = "me/friends"
bundle.putString("fields","birthday");

和调用上述要求的方法,它会给你的生日,但你必须添加 friends_birthday 许可。

and call above request method, it will give you birthdays but you have to add friends_birthday permission.

这篇关于Android版的Facebook API:如何获得有关user`s朋友扩展信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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