Skip to content

Instantly share code, notes, and snippets.

@thedoapps
Created July 31, 2014 17:13
Show Gist options
  • Save thedoapps/1012b4e9be80a3696b53 to your computer and use it in GitHub Desktop.
Save thedoapps/1012b4e9be80a3696b53 to your computer and use it in GitHub Desktop.
Get User Facebook Information
private void makeMeRequest() {
Request request = Request.newMeRequest(ParseFacebookUtils.getSession(),
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
String nombre = (String) user.getProperty("first_name");
String apellido = user.getLastName();
String sexo = (String) user.getProperty("gender");
String nacimiento = user.getBirthday();
String email = (String) user.asMap().get("email");
String password = "";
String nick = (String) user.getProperty("middle_name");
String facebookId = user.getId();
try {
JSONObject jsonObjectUsuario = new JSONObject();
jsonObjectUsuario.put("nombre", nombre);
jsonObjectUsuario.put("apellido", apellido);
jsonObjectUsuario.put("sexo", sexo);
jsonObjectUsuario.put("nacimiento", nacimiento);
jsonObjectUsuario.put("email", email);
jsonObjectUsuario.put("password", password);
jsonObjectUsuario.put("nick", nick);
jsonObjectUsuario.put("facebook_id", facebookId);
jsonObjectUsuario.put("tipo_registro", "2");
Log.e("RESPONSE - ", jsonObjectUsuario.toString());
//progressDialog = ProgressDialog.show(getActivity(), null, "Registrando...", true);
Operation_Registro operation_registro = new Operation_Registro(getActivity());
operation_registro.setJsonObjectUsuario(jsonObjectUsuario);
/*
operation_registro.registrarUsuario();
operation_registro.setInterface_operation_registro(new Operation_Registro.Interface_Operation_Registro() {
@Override
public void registrarUsuario(boolean state, Usuario_DTO usuario_dto) {
progressDialog.hide();
Log.e("RESPONSE - ", usuario_dto.getJsonObject().toString());
}
});
*/
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
);
request.executeAsync();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment