SimpleNoSQL- An all-new framework for hassle-free Android App Development

The ever-expanding regime of Android Application Development industry has impressed and encouraged developers to build apps that can run on all Android enabled devices. With the release of innovative local data frameworks, Android developers have found it convenient to store and retrieve objects to and from the disk. The latest to join this group of impressive Android local data frameworks is SimpleNoSQL. In this blog, I’ll brief you about this Android app development framework and help you know it inside out.

How’s SimpleNoSQL different from other local data frameworks used for Android?
Well, unlike other data frameworks where the developer needs to deal with files and SQL for storing and retrieving objects to/from disk, with SimpleNoSQL the usage of SQL is eliminated as a whole.

SimpleNoSQL- A brief on its functioning

Image 2

If you’re involved with Android Application Development Services who just wants to save data but doesn’t really want to worry about its storage and wants to avoid the hassles of setting up a database manually, then SimpleNo SQL is a library that will make things simpler for you. With SimpleNoSQL, saving data is pretty much simple.

Let’s take an example. Mentioned below is a class that contains data:

public class MyData {
public String name;
public String title;
public int goRating; //for how good at Go you are
}

Now, in order to save the data to the disk using SimpleNoSQL, you’ll need to include the below mentioned coding:
MyData data = new MyData();
data.name = “Colin”;
data.title = “Developer”;
data.goRating = 9;
NoSQLEntity<MyData> entity = new NoSQLEntity(“personBucket”, “colin”);
entity.setData(data);
NoSQL.with(context, MyData.class)
.save(data);

If you notice the above mentioned code snippet carefully, you’ll find that there’s no need for setting up the database or some sort of executor. The data storage operation takes place on a separate thread and the entry is saved into a bucket called “personBucket”. This data bucket comes with an id of “colin” and also the second id argument is optional. If you fail in supplying an explicit UUID, the system will generate a random one automatically.

Below is the code used for retrieving the entry that was saved into the “personBucket”

NoSQL.with(context, MyData.class)

.bucket(“personBucket”)
.entityId(“colin”)
.retrieve(new RetrievalCallback<MyData>() {
public void retrievedResults(List<NoSQLEntity<MyData>> entities) {
MyData data = entities.get(0).getData();
// display it or something
}
});

In the above code, RetrievalCallback is an amazing interface that can either be declared inline or you can have the fragment implement it. The RetrievalCallback request is asynchronous and will be querying the data on a background thread. Once the results are ready for retrieval, the RetrievalCallback method is being called on the UI thread for you to display the results.

Likewise, if you’re inclined on retrieving an entire list of items a user has entered, then using the below code is beneficial:

NoSQL.with(context, MyData.class)

.bucket(“personBucket”)
.retrieve(new RetrievalCallback<MyData>() {
public void retrievedResults(List<NoSQLEntity<MyData>> entities) {
for (NoSQLEntity entity : entities) {
MyData data = entity.getData();
// do something with this
}
}
});

SimpleNoSQL- Add-ons that make Android development more convenient

Image 3

Well, in addition to help proficient Android Apps Developer to store and retrieve objects to/from disk, there are ample number of other add-ons that make SimpleNoSQL different from other local data frameworks used for Android development. Some interesting add-ons include the following:

  •  Filtering of data based on a supplier filter
  •  Ordering the results of a list using a Comparator
  •  Deleting specific entities or entire buckets

For example:

Case 1- If you want to delete data, you need to include the below code:

NoSQL.with(context).using(SampleBean.class)
.bucket(“bucket”)
.entity(“entityId”)
.delete()
Case 2- If you want to delete a single entity or an entire bucket, you need to include the below code:

NoSQL.with(context).using(SampleBean.class)
.bucket(“bucket”)
.delete()

Adding SimpleNoSQL into your Android App Development project

Image 4

In order to add SimpleNoSQL into your project, all you need to do is simply add the following code to your project’s build.gradle file:
repositories {

mavenCentral()
maven {
url ‘https://oss.sonatype.org/content/groups/public’
}
}

dependencies {
compile ‘com.colintmiller:simplenosql:0.2.0’
}

Conclusion

Although SimpleNoSQL is still in its development stage, the API has already started gaining momentum among Android developers. With the current API using gson for serialization and deserialization, we can surely expect the framework to bring in lot more functionality improvements and enhancements in the years to follow.

Author Bio:

Juana Steves Juana Steves is a technical writer associated with Xicom Technologies – a leading Android Development Company. With her best advices, you can also avil Android App Developers for hire, in case you are looking forward for the same.

Published by

Admin

Priya Ranjan is Science(IT) Graduate & is pursuing his further studies in Science Technology. He is the Founder of Blogging Hits. He loves to write about software's, SEO, Social Media and Technology.

Leave a Reply

Your email address will not be published. Required fields are marked *