public async void OnCompleted(Org.Json.JSONObject json, GraphResponse response){ string tag = "OnCompleted"; Log.Debug (tag, "Lel, datos :v"); try{ string email = json.GetString ("email"); Log.Debug (tag, "el email debería ser: "+email); if (email == "" || email == null || email == "null") { //aqui vamos a cachar si no hay email para no hacer el registro. } else { datosfb.Add ("email", email); //ya tenemos todo, ahora podemos mandarlo!, tal vez aqui considere poner la foto de perfil y el nombre en la pantalla string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/log_reg_face", null, "nada", "file[]", "image/jpeg", datosfb, true); Log.Debug (tag,"LA RESPUESTA!!!: "+resp); JsonValue respuesta = JsonValue.Parse(resp); //Estructura de respuesta: [{"u":{"id":"225","username":"******","nombre":"Rutiaga","apellidos":"Cervantes","email":"*****@*****.**","rol":"cliente","facebook_id":"10204786604253973","puntos":"100"},"iu":{"ruta":"https:\/\/graph.facebook.com\/10204786604253973\/picture?height=800&width=800&migration_overrides=%7Boctober_2012%3Atrue%7D"}}] if (respuesta != null) { var prefs = this.GetSharedPreferences("RunningAssistant.preferences", FileCreationMode.Private); var editor = prefs.Edit (); string n=respuesta[0]["u"]["nombre"]; string ap=respuesta[0]["u"]["apellidos"]; editor.PutString ("id", respuesta[0]["u"]["id"]); editor.PutString ("nombre", n+ap); editor.PutString ("email", respuesta[0]["u"]["email"]); editor.PutString ("img_perfil", respuesta[0]["iu"]["ruta"]); editor.Commit(); //JA //Toast.MakeText (this, "Inicio de sesión correcto", ToastLength.Long).Show(); StartActivity(typeof(MainActivity)); Finish(); } else { Toast.MakeText (this, "Há ocurido un inconveniente. Por favor inténtalo de nuevo!", ToastLength.Long).Show(); } } //CATCH }catch(Exception ex){ Log.Debug ("OnCompleted", "Algo Salio mal en el OnCompleted! " + ex); //Toast.MakeText (this, "Algo salió mal. Por favor inténtalo de nuevo.", ToastLength.Long).Show(); infoface = FindViewById<LinearLayout> (Resource.Id.infoface); infologin = FindViewById<LinearLayout> (Resource.Id.infologin); infologin.Visibility = ViewStates.Visible; infoface.Visibility = ViewStates.Gone; } }
public void OnCompleted(Org.Json.JSONObject json, GraphResponse response) { string data = json.GetString("email"); email.Text = data; }