本文介绍了使用Facebook的官方公报,Android的SDK获取用户配置文件的Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Facebook的Android的SDK的签收单上,但我不能老是让用户的Facebook个人资料的数据。这是我的code:
i am using facebook-android-sdk for a single sign on, but i can`t get user facebook profile data. this is my code:
try {
JSONObject me = new JSONObject(facebook.request("me"));
String id = me.getString("id");
String name = me.getString("name");
System.out.println("Id: " + id + " ---- " + name);
}catch(Exception ex) {
System.out.println(ex);
}
如何获取用户的数据资料?
谢谢你!
How get user data profile?Thanks you!
推荐答案
只要你登录。
AsyncFacebookRunner myAsyncRunner = new AsyncFacebookRunner(facebook);
myAsyncRunner.request("me", new meRequestListener());
请求监听器:
public class meRequestListener implements RequestListener() {
@Override
public void onComplete(String response, Object state) {
//response is your JSON response
}
//You also have to override all the other methods
}
这篇关于使用Facebook的官方公报,Android的SDK获取用户配置文件的Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!