How to get Facebook profile ID using Android and Graph API?

How to get the profile ID in the Facebook profile that I logged in through the Android application?

I managed to log in to Facebook using Android and the graphical API, but I want to get the profile ID of the specific Facebook profile that I'm signed in to.

Please help me solve this problem. I am new to Android and Facebook Graph API. I searched a lot, but I did not find a workaround.

+5
source share
1 answer

Facebook's graphical API allows you to make calls that return JSON that you can play on Android using JSONObject .

Facebook fb = new Facebook(API_KEY);
// ... login user here ...
JSONObject me = new JSONObject(fb.request("me"));
String id = me.getString("id");
+17
source

All Articles