Marcos Roriz Junior
Marcos Roriz Junior

Reputation: 4106

Grab current user ID with facebook-android API

With Graph API for Android I can get the current user stuff with "/me" calls.

Until here, everything is fine, but I can't find a way to grab the user real ID (numbers)? How can to do that?

Upvotes: 4

Views: 4985

Answers (1)

IBoS
IBoS

Reputation: 550

/me returns a JSON object with an id field (and others). You can parse this JSON object like this:

JSONObject json = Util.parseJson(facebook.request("me", params));
String userId = json.getString("id");

Upvotes: 12

Related Questions