I'm trying once to login to facebook from my application on android to get a list of my friends, as well as some data, I'm guiding me for this link but at the time of consultation the json that returns me it turns out to be empty, this is the code
public void amigos(String id){
// final String returnString="prueba " ;
//final String canamigo="0";
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/friends",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
String nombres="nombres: ";
String otro="nombres: ";
try {
JSONObject json_data=response.getJSONObject();
JSONArray frienArray = ((JSONArray) (response.getJSONObject().get("data")));
System.out.println("este es el jsom"+json_data);
//JSONArray aray=json_data.getJSONArray("data");
System.out.println("este es el array2"+frienArray.length());
if(frienArray!=null) {
System.out.println("no es nulo "+frienArray);
for (int i = 0; i < frienArray.length(); i++) {
JSONObject amigo = frienArray.getJSONObject(i);
System.out.println("nombre de la persona :-"+amigo.getString("first_name"));
otro= amigo.getString("first_name");
}
}
TextView listaAmigos=(TextView) findViewById(R.id.nombres);
listaAmigos.setText(otro);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
).executeAsync();
TextView listaAmigos=(TextView) findViewById(R.id.nombres);
listaAmigos.setText(id);
Log.d(id, "onCompleted: esto es el id");
}
I have tried several ways but nothing, some idea that can help me. thanks in advance