[英]How do I get the Facebook profile id using Android and Graph API?
How do I get a profile id of a Facebook profile to which I have logged in through my Android application? 如何获取我通过Android应用程序登录的Facebook个人资料的个人资料ID?
I have been able to log in to Facebook using the Android and Graph API, but I want to fetch the profile ID of the specific Facebook profile to which I have logged in. 我已经能够使用Android和Graph API登录Facebook,但我想获取我登录的特定Facebook个人资料的个人资料ID。
Please help me solve this problem. 请帮我解决这个问题。 I am new to Android and the Facebook Graph API.
我是Android和Facebook Graph API的新手。 I have searched a lot, but I didn't find any workaround to this.
我搜索了很多,但我没有找到任何解决方法。
The Facebook graph API lets you make calls that return JSON, which you can parse in Android with a JSONObject . Facebook图形API允许您进行返回JSON的调用,您可以使用JSONObject在Android中进行解析。
Facebook fb = new Facebook(API_KEY);
// ... login user here ...
JSONObject me = new JSONObject(fb.request("me"));
String id = me.getString("id");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.