Parse for a backend

Parse is a simple way to host data. It is free for the for 1 million API calls per month and 1 GB of data hosted. It is good for creating users and hosting simple data entries. It lacks an easy way for complex queries so using as a backend for a recommendation app is probably a bad idea. Although the queries lack complexity, it is good for hosting data related to a user for example making a form.

Creating a user is simple. The following code would create a user with the username :Name and the password: Password.

 

ParseUser user = new ParseUser();

user.setUsername(“Name”);

user.setPassword(“Password”);

user.setEmail(“email@example.com”);

user.signUpInBackground(new SignUpCallback() {

public void done(ParseException e) {

if (e == null) {

// Sign up did succeed.

} else {

// Sign up didn’t succeed.

}

}

});

 

The hardest part of parse is getting queries result for example the following code would get all the names from the table Story where entry equals 0 and toast them:


ParseQuery basicquery = ParseQuery.getQuery("Story");

basicquery.whereEqualTo(“entry”, 0);

basicquery.findInBackground(new FindCallback() {

@Override

public void done(List storyList, ParseException e) {

if (e == null) {

ParseObject object;

final Iterator iterator=storyList.iterator();

String s;

for(int k=0; k<storyList.size(); k++)

{

object=iterator.next();

s=(String) object.get(“Name”);

Toast.makeText(getApplicationContext(), s, Toast.LENGTH_LONG).show();

}

}

}

}

);

 

For more information on how to use Parse you can visit:

https://www.parse.com/docs/android_guide