简体   繁体   中英

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?

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.

Please help me solve this problem. I am new to Android and the 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 fb = new Facebook(API_KEY);
// ... login user here ...
JSONObject me = new JSONObject(fb.request("me"));
String id = me.getString("id");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM