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 Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.
You can get user data by using the Facebook Graph API if the user has given their permission to share their data and your app has the appropriate permissions to receive this data. This topic shows you how to make a single request for data and how to have a batch of requests in a single request.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With