Skip to content

Instantly share code, notes, and snippets.

View osw4l's full-sized avatar
🎹
Piano player

Oswaldo Rodriguez osw4l

🎹
Piano player
  • universidad libre de colombia
  • Barcelona, Spain
  • 16:07 (UTC +02:00)
View GitHub Profile
public void getOrCreateUser(final ParseUser parseUser, final String email, final ProgressDialog dialog){
String URL = "https://example.co/api/accounts?email="+ email +"&action=get_or_create";
JsonArrayRequest req = new JsonArrayRequest(URL, new com.android.volley.Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray jsonArray) {
try {
JSONObject apiUser = jsonArray.getJSONObject(0);
parseUser.put("email", email);
parseUser.put("api_token", apiUser.getString("token"));
parseUser.put("api_id", apiUser.getInt("id"));