Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 553
Marcos Roriz Junior Avatar asked Dec 17 '22 13:12

Marcos Roriz Junior


1 Answers

/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");
like image 56
IBoS Avatar answered Jan 03 '23 12:01

IBoS