android-mesosfer-integration

How to Query Data Android Mobile Apps in Mesosfer Backend as a Service

This is a tutorial about How to Query Data Android Mobile Apps in Mesosfer Backend as a Service

Introduction

This Tutorial is the sixth session of Android Mobile Apps series. In this tutorial you will be required some dependency source code you created in the previous session. In this session, we’ll create module to get all data in a Mesosfer Bucket.

Prerequisites

To follow this tutorial, you will need to prepare these items below :

  • Sign up for an account in Mesosfer Backend as a Service.
  • Install latest android studio. In this tutorial, the author used android studio version 2.2.1
  • Download code from previous section.

Getting Started

We have tried to do a query and filter user data in the previous session. There is bucket menu in Mesosfer Backend as a Service, you can create dynamic table and curtomize based on what you need.

In this session you will try to make a bucket in Mesosfer and then display it in Android Apps.

how-to-query-data-android-apps-in-mesosfer-backend-as-a-service-create-bucket

In the picture above, you have created Animal bucket which has 3 foot column (Number), isMamal (Boolean), and the name (String). The bucket number or the number of columns and data types can be defined according to your needs. Then for the next you need to create a new activity (DataActivity).

how-to-query-data-android-apps-in-mesosfer-backend-as-a-service-data-activity

Go to layout and change activity_data.xml, tambahkan code below.

All data in the bucket will be displayed in the ListView above, the data is from DataActivity. You need to set up some code into DataActivity.

Firstly, you must define some variables then put on method onCreate.

Then initialize the variable on method onCreate.

In the last variable initialization, there’s a method updateAndShowDataList. The data will be conducted from Mesosfer Backend as a Service. Define Your bucket name before the data retrieval process starts. In the code below, you will take the existing data in the Bucket “Animal” which is the bucket you created previously.

You need to add the button layout activity_main.xml to navigate into ActivityData. Add the following script at the top of the log out button.

Change MainActivity and add method below to process navigation above:

In the mobile apps, it will show result as in the picture below.

how-to-query-data-android-apps-in-mesosfer-backend-as-a-service-mobile-result

Everything is done! Download full version code here.

Conclusion

We have created module to get all data on Mesosfer Bucket. Very simple and quick, isn’t it? Mesosfer helps you connect your project to the cloud. Cut off the development process so you can straight into the delivery process instead stumble on the complicated infrastructure.

Having more than 5 years experience in IT Consultant with the last position as Backend as a Service Developer and has an experience in planning, implementing IT Information System.