Skip to content

Instantly share code, notes, and snippets.

@manuel14
Created October 16, 2015 15:46
Show Gist options
  • Save manuel14/57eb4219693c89e39dad to your computer and use it in GitHub Desktop.
Save manuel14/57eb4219693c89e39dad to your computer and use it in GitHub Desktop.
//esto es en android en la welcomeActivity
String userId = currentUser.getObjectId();
final HashMap<String, Object> params = new HashMap<>();
params.put("id", userId);
ParseCloud.callFunctionInBackground("getTeam", params, new FunctionCallback<ParseObject>() {
public void done(ParseObject o, ParseException e) {
if (e == null) {
Toast.makeText(getApplicationContext(),
"Tiene equipo",
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(),
e.toString(),
Toast.LENGTH_LONG).show();
}
}
});
//funcion definida en el cloud
Parse.Cloud.define("getTeam", function(request, response) {
var team = Parse.Object.extend("Team");
var query = new Parse.Query(team);
var id = request.params.id;
query.get(id , {
success: function(team) {
response.success(team);
},
error: function(request) {
response.error(id);
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment